Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR adds Jira as an option #61

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated readme,creds, and enpoints
  • Loading branch information
mattdough committed Jan 5, 2022
commit a661d80e3547c86a557fb4fd78a7c13da8526ec8
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Here is an example of a conversation you can have with this bot:
- [Rasa Helpdesk Assistant Example](#rasa-helpdesk-assistant-example)
- [Setup](#setup)
- [Install the dependencies](#install-the-dependencies)
- [Configure endpoints](#configure-endpoints)
- [Optional: Connect to a ServiceNow instance](#optional-connect-to-a-servicenow-instance)
- [Optional: Connect to a Jira Instance](#optional-connect-to-a-jira-instance)
- [Running the bot](#running-the-bot)
- [Things you can ask the bot](#things-you-can-ask-the-bot)
- [Example conversations](#example-conversations)
Expand Down Expand Up @@ -49,13 +51,15 @@ pre-commit install
> With pre-commit installed, the `black` and `doctoc` hooks will run on every `git commit`.
> If any changes are made by the hooks, you will need to re-add changed files and re-commit your changes.

### Optional: Connect to a ServiceNow instance
### Configure endpoints

You can run this bot without connecting to a ServiceNow instance, in which case it will
You can run this bot without connecting to a ServiceNow or Jira instance, in which case it will
send responses without creating an incident or checking the actual status of one.
To run the bot without connecting ServiceNow,
you don't need to change anything in `actions/snow_credentials.yml`; `localmode` should already be set
to `true`
To run the bot without connecting to ServiceNow or Jira you don't need to change anything
in `endpoints.yml`; `helpdesk: mode:` should already be set to `local`.

When set to `local` (default in the code), it will just take all the data in and message out the information that would normally be sent.
### Optional: Connect to a ServiceNow instance

If you do want to connect to ServiceNow, you can get your own free Developer instance
to test this with [here](https://developer.servicenow.com/app.do#!/home)
Expand All @@ -68,7 +72,22 @@ To connect to your ServiceNow developer instance, configure the following in `ac

- `snow_pw` - The password of the service account for the ServiceNow developer instance

- `localmode` - Whether the action server should **not** try to reach out to a `snow_instance` based on the credentials in `actions/snow_credentials.yml`. When set to `True` (default in the code), it will just take all the data in and message out the information that would normally be sent.
In `endpoints.yml` configure `helpdesk: mode:` to `snow`.

### Optional: Connect to a Jira Instance

If you want to connect to Jira Service Management, you can setup a free limited instance [here](https://www.atlassian.com/software/jira/service-management/free)

To connect to your Jira instance, configure the followingin `actions/jira_credentials.yml`:
- `jira_user` - This is the email of the admin account for the Jira instance

- `jira_token` - This is the API Token for your Jira instance. Get it [here](https://id.atlassian.com/manage-profile/security/api-tokens)

- `jira_url` - The url for the Jira instance. Should be in the form https://your-domain.atlassian.net

- `project: id` - The id for your project. Can be found using the API https://your-domain.atlassian.net/rest/api/3/project

In `endpoints.yml` configure `helpdesk: mode:` to `jira`.

## Running the bot

Expand All @@ -80,7 +99,7 @@ Then, to run, first set up your action server in one terminal window:
rasa run actions
```

In another window, run the duckling server (for entity extraction):
In another window, run the duckling server (for netentity extraction):

```bash
docker run -p 8000:8000 rasa/duckling
Expand Down
13 changes: 1 addition & 12 deletions actions/jira_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

logger = logging.getLogger(__name__)

cred_path = str(pathlib.Path(__file__).parent.parents[0]) + "/.vscode"
cred_path = str(pathlib.Path(__file__).parent.absolute())


class JiraAPI(object):
Expand Down Expand Up @@ -108,14 +108,3 @@ def priority_db() -> Dict[str, int]:
"""Database of supported priorities"""
priorities = {"low": "4", "medium": "3", "high": "2"}
return priorities


if __name__ == "__main__":

jira = JiraAPI()

# test assigned issues
# email = "ADMINEMAIL" with issues assigned
# account_id = jira.email_to_sysid(email).get("account_id")
# my_issues = jira.assigned_issues(account_id)
# print(my_issues)
3 changes: 2 additions & 1 deletion endpoints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ action_endpoint:
# username: username
# password: password
# queue: queue

helpdesk:
mode: jira #local, snow, jira
mode: local #local, snow, jira