/poet-slack-bot

Project Oriented Enlightenment Tool (POET) bringing intelligent JIRA interaction to your Slack channel.

Primary LanguageJavaApache License 2.0Apache-2.0

POET-SLACK-BOT: Integrating SLACK with JIRA


POET is an intelligent Slack-Bot that knows more about your JIRA project than anybody else on the team!

Check out this video to get an idea of the POET project.

Example

Motivation

This project was proposed and supported by Agile Digital as part of the Australian National University's TechLauncher initiative.

Overall Architecture

architecture

Preparation


Install the following packages

  • Download Activator and add it to your PATH.

  • Donwload and install Node.js and npm

  • Install Hubot by run npm install -g yo generator-hubot in your terminal

  • Download and install Docker.

Get a hubot API token from Slack for your team

First, go to the Slack Apps&Configurations for Hubot and sign to the Slack team you want our bot to be added to.

hubotconfiguration

Then creat a new hubot configuration by giving the bot a name, then your own hubot-slack API token is generated.

addhubotconfiguration

Now you can invite the bot to the channel you want, but the bot is inactive and cannot speak at the moment. Follow the next steps to make it alive!

Set up a database to store questions

  1. To host PSQL on local host using Docker(required to do only the first time)

    docker run -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=password -d postgres

  2. Then start the postgres before running POET

    docker start postgres

  3. To alter the database

    docker exec -it postgres bash

  4. To enter psql using -U postgres

    psql -U postgres

  5. To create a database

    postgres=# CREATE DATABASE database_name_here;

  6. To create a user

    postgres=# Create USER user_name_here WITH PASSWORD 'user_password_here';

  7. To set or change the owner of the database

    postgres=# ALTER DATABASE database_name_here OWNER TO user_name_here;

Import POET to LUIS

This part is for people who want to develop future features based on POET. If you just want to try the current features of POET, please skip it.

Import POET into LUIS and train it. A good tutorial can be found on LUIS's homepage.

Configuration


Set-up environment variables for your Atlassian JIRA instance:

  1. JIRA_USERNAME="JIRA username"
  2. JIRA_PASSWORD="JIRA password" (Your password will not be visible to other users or developers).
  3. JIRA_BASE_URL="JIRA server domain"

Set-up environment variables for Postgress Database:

  1. DB_HOST="database host"
  2. DB_NAME="database name"
  3. DB_USERNAME="database username"
  4. DB_PASSWORD="database password"

Set-up environment variables for LUIS:

  1. LUIS_URL="LUIS app url"
  2. LUIS_APPID="LUIS app id"
  3. LUIS_SUBSCRIPTION_KEY="LUIS subscription key"

Installation


  1. Create a new directory and do a git clone using command-line.

    git clone https://github.com/agiledigital/poet-slack-bot

  2. From your command-line, go to the server directory from the directory where you have cloned the project and run the activator by using the following line.

    activator run

  3. Go back the client directory of the directory where you have cloned the project and run the hubot using the following code. Make sure to replace YOUR_HUBOT_SLACK_API_TOKEN_HERE with the API token obtained in the previous step.

    HUBOT_SLACK_TOKEN=YOUR_HUBOT_SLACK_API_TOKEN_HERE ./bin/hubot --adapter slack

Getting Started


After successfully running the client side and server side, the bot is now active in your channel. Let's have a conversation with it!

Here are some examples questions you can try asking the bot:

  • To Ask the bot for the description of a ticket in your project ticketdescription ticketdescription2 ticketdescription3 ticketdescription4 ticketdescription5 ticketdescription6

  • To Ask the bot for the assignee of a ticket in your project assignee assignee1 assignee2 assignee3 assignee4

Current Features


Here is a list of features that were already developed.

  1. Say hi to POET, then it will introduce itself to you.

sayhi

  1. POET is now able to fetch five types of information of project from JIRA:

    1. To know the description of a ticket, there are various question forms the users can ask the bot. The example below shows the query about the description of a ticket, for example, POET-45, which is a ticket in POET project.
    questionformsdescription1 questionsformsdescription2 questionsformsdescription3
    1. When it comes to the assignee of a ticket, there are also various forms of questions the users can ask the bot. The snapshot below demonstrates the query about the assignee of a ticket, for example, POET-5, which is aslo a ticket in POET project.
    questionsformsassignee
    1. POET can understand the query about the status of a ticket in various forms and fetch the status information about the ticket.
    ticketstatus
    1. POET can fetch a list of tickets a person is currently working on from JIRA:
    image
    1. POET can also fetch tickets in a given status by users from JIRA:

      For example, to ask for the completed tickets:

      image

      Or ask for the in-progress tickets:

      in progress
  2. When POET cannot understand a question or cannot find the information, it will also reply the users.

cannotfindissu

cannotunderstandissue

  1. POET can store all the questions the users asked in database, which will help improve it’s performance through later analysing and training with the dataset.

questionlist

Future Features


There are two steps to improve the intelligence of the bot:

  1. Explore the JIRA Rest API to find out the information that can be fetched, e.g. the status of a ticket

  2. Train the bot to make it understand various types of questions, e.g. what are the tickets in progress? A quick way to make the bot understand that is to import our POET-SLACK-BOT to LUIS and use LUIS to train it. Or you can update the decision trees for the bot.

After collecting the feedback, we sort out a list of features which are worth to develop in the future as shown below. Basically the features can be divided into two groups:

  1. Incorporate more questions for fetching information from JIRA:

    i. What are the tickets in progress/stalled/completed?

    ii. What tickets need testing?

    iii. What are the tickets I'm working on?

    iv. How long has the issue has been stalled?

    v. Show me the changes since yesterday.

  2. Incorporate questions for modifying information on JIRA:

    i. Please stall YOUR_TICKET_KEY_HERE

    ii. Please move YOUR_TICKET_KEY_HERE to completed

    iii. Can you resolve all sub-tasks of POET-1?

    iv. Please assign YOUR_TICKET_KEY_HERE to YOUR_TEAM_MEMBER_NAME_HERE.

Contributors

We are a team of students from the Australian National University (ANU). We're passionate about harnessing the potential of artificial intelligence to make work and life better.

Original authors of the code in this package include (in alphabetical order): Team Members:

Support

Contact poet-dev@hotmail.com.

Acknowledgements

The authors would like to thank Agile Digital for the proposal and guidance.

Licence

This work is licensed under the Apache License Version 2.0 (APLv2).