Skip to content

paircast/mlh-webex-bot-trello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webex Chatbot Trello Add Card

this package was created with the intent of teaching how to make integrations into Cisco Webex Chat system.

What does this do?

This specific integration will allow any person to add a card onto a trello board. This bot works by 'listening' for specific keywords and then starting a conversation based on that keyword. Then it will start a conversation in order to gather the required information to be able to create a card on your trello account. When you have completed the small conversation that you have with this chatbot, you will now have a new card on one of your lists in trello.

Installation

First

Go to Botkit studio in order to get an access token to use BotKit. Once you get an access token, that needs to be placed in the .env file as the access_token.

Building a bot with Botkit Get the access token from Botkit

Second

Download the Cisco Webex Desktop platform and install and run it. Once you get to the enter your work email address page just type in any email address and continue with creating a password.

Login page on Webex Platform

Next thing that you need to do is go to the Cisco Webex Developer Page and log in with the email address that you just created on their desktop platform to register a new bot. After you have finished creating a new bot, make sure that you note the email address that you added for the bot because it will be used later on.

Webex add bot button Cisco Developer Create a Bot Form with the email

Third

Go to Trello and make sure that you are logged in and this link will take you to get a key for your application. Also where it says "you can manually generate a Token" click on the link and get a token for this application. Those two fields need to be saved under the trello_key and the trello_token fields of the .env file.

Trello Generate API key

Fourth

Install Heroku on your computer. Heroku is a platform that allows you to upload node.js and Express projects to host them as easily as using Git. After installation, go onto your command prompt and navigate to your repository location. Then type "heroku create". It will then generate a public location for your application to be hosted so that Cisco Webex can access it. Place the address that was just created into the public_address field of the .env file.

Fifth

Fill in the last field in the .env file. the secret field is any password that you want.

Sixth

Go into your Heroku Dashboard and click on the app that you just created. Go into the settings of the application and click on "Reveal Config Vars" This will be where you need to add each of the fields from the .env file into these locations. Add new fields for each .env line.

Heroku Config variables

Seventh

Go back into the command prompt and type "git push heroku master" this will now upload the app and build it and run it.

Eighth and Last

Open up the Cisco Webex Platform again. Once it is open, click on the plus button on the top left to the right of the search bar and click on "contact a person". in the search box that appears, you will need to type the email address that you noted down in step one. This will start a new chat with the bot!

Webex Plus button add a new chat.

Usage

The only thing that this project is currently capable of doing is creating a new card on trello, in order to start the process of creating a card, you need to just type:

/taskbot

This will initiate the process of creating a new card on trello and the chatbot will do the rest of the teaching!

Example Code

this example shows how we can create a conversation with the bot and when they type /taskbot, this will then start with the question 'Please enter in a name for the new card' then it will wait for a response. Once you enter in a response, it will continue into the next 'Thread' or question and ask 'Please enter in a description for the new card' then again it will wait for a response. Then it will tell the conversation to go into the next 'Thread' but this time there is something that gets called before the 'completed' thread gets initialized, it will do a beforeThread function, where it will use npm trello to add a card onto the list that is provided for the list variable.

convo.addQuestion({text: "Please enter in a name for the new card"}, function(res, convo){
    convo.gotoThread('card-description');
}, {key: 'card-name'}, 'default');

convo.addQuestion({text: "Please enter in a description for the new card"}, function(res, convo){
    convo.gotoThread('completed');
}, {key: 'card-description'}, 'card-description');

convo.beforeThread('completed', function(convo, next){
    let name = convo.extractResponse('card-name');
    let description = convo.extractResponse('card-description');
    let list = 'ENTER A LIST ID HERE';
    let create = trello.addCard(name, description, list);
    create.then((res) => {
        next();
    });
});

convo.addMessage("Congrats you have created a card on trello!", 'completed');

Pull Requests

If you wish to contribute to this package, please clone the repository and create a pull request. Thank you so much!

About

Webex Add Card to Trello Command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published