Example slack bot using AWS Lambda and Lex
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
terraform
.gitignore
Makefile
README.md

README.md

Slackbot with AWS Lex and Lambda

This repository contains an example of a slack bot with AWS Lex and Lambda, for details and a walk through on how this was created please read the blog post at: chttps://nicholasjackson.io/2017/04/25/slack-bot-aws-lambda/.

This project does not use any frameworks such as Serverless or Apex. It is a plain example which uses Terraform to deploy the Lambda function.

Requirements:

Caviates

  • I am not a JavaScript programmer
  • This not a comprehensive example but more of a getting started
  • Deployment to AWS may incur costs

Building

The code is written in Javascript and requires no building as such however there is a build step which will copy the required files and install the node modules ready for packaging to AWS Lambda.

$ make build

Testing

Testing is performed with Jest, to run the example tests:

$ make test

The tests are not comprehensive however and are intended to show how unit tests can be leveraged to cover the inability to run the application code locally with AWS Lambda.

Deploying

Set the following environment variables I recommend using direnv https://direnv.net:

Variable Description
TF_VAR_slack_api_key A valid key to access the slack API
AWS_SECRET The secret for your AWS account
AWS_SECRET_KEY The secret key for your AWS account

Run...

$ make deploy

The function will be deployed to us-east-1 virginia which is currently the only region which supports Lex.