As a company grows, more and more information is generated. This information comprises HR policies, administrative and technical processes, company benefits and IT know-how. As the resources within the company increase, the need to place them in an easily-accessible repository becomes critical.
In response to this issue, a few of us at Gorilla Labs decided to create a Slack-integrated chatbot. The chatbot was implemented using Amazon Web Services Lex, and the final solution only incorporated AWS and Slack-provided services. Our use of servers was limited, as we wanted to keep the cost of the project to a minimum. We decided to name our assistant chatbot “Winston.”
While Amazon Lex provides both speech recognition and natural language understanding, our scope for this project was to create a text-based chatbot using only Lex’s natural language understanding. This functionality makes Winston a useful Slack-integrated application without limiting its ability to one day be integrated it into a speech interface such as Amazon Alexa.
This repository represents the code for the AWS lambda function that handles specific intents supported by the chatbot. The whole idea of using a lambda function is to keep costs at the minimum.
If you want to check all the intents supported by Winston please take a look at the Winston's Questions Set. When you add or correct utterances please do so in Suggesting mode so is evident for developers reviewing the document which changes to apply to the actual bot on Amazon Lex.
The Amazon Lex bot can be found here: Winston bot. You will need an AIM role and the proper permissions to be able to edit the bot using the dashboard.
We use Pascal Case for the intent names on Amazon Lex. When adding new intents please ensure the name is meaningful and comprehensive try using prefix that give hint of category. For instance: "SmallTalkSayHello" could be a good name for a "say hello" intent. Don't forget to add the new intent to the Winston's Questions Set documentation.
This diagram represents the high-level architecture of the solution
The Amazon Lex chatbot is integrated with our corporate Slack workspace. A company employee interacts with Winston by chatting with it directly (you could find it under Apps). Most of the interactions are handled directly by the bot but some intends are delegated to the AWS Lambda function such as all the actions that require data from our HR system (BambooHR).
To upload changes to the AWS lambda function you can use Serverless Framework. The configuration file serverless.yml is not part of the repository because it contains the secret API keys (This is a bad practice those should be handled by using a key management service such as Amazon KMS).
To install serverless use the following command:
npm install -g serverless
To configure use the Serverless Config Credentials command with the credentials provided by your own AWS user.
serverless config credentials --provider aws --key YOURKEY --secret YOURSECRET --overwrite
Serverless: Setting up AWS...
Serverless: Saving your AWS profile in "~/.aws/credentials"...
Serverless: Success! Your AWS access keys were stored under the "default" profile.
Inspect the following file you should see an output as the one below:
cat ~/.aws/credentials
[default]
aws_access_key_id = YOURKEY
aws_secret_access_key = YOURSECRET
This is the content of the configuration file for serverless. The environment variables should be requested to the project owner.
service: winstonbot
provider:
name: aws
runtime: nodejs12.x
functions:
winstonbot:
handler: handler.winstonbot
environment:
bambooApiKey: xxx
slackApiToken: xxx
parkingAPIMagicKey: xxx
To deploy the lambda function use the following command:
serverless deploy
The design work for the bot was done by our UI/UX designer Ana Beatriz Bravo.
Download the original image from here: Winston_GoogleAssistantBanner.png
Download the original image from here: Winston_192x192.png
Download the original image from here: Winston_512x512.png