Serverless slackbot deployed via a python terraform wrapper.

git clone
cd lambdabot
cp lambdabot_config.json.example lambdabot.conf
edit lambdabot.conf with your specific info and save
python3 --apply


Recently I’ve found myself with a number of projects that could really benefit from an easily accessible method of interaction. Typically this interaction takes the form of a command line program with one or two imputs, which then runs some form of a lookup, transform or other process. These types of interactions are ideal places for chatbots, as often it is beneficial to be able to expose this functionality to others as well. A chatbot removes the barrier to entry for most users, by abstracting the need to maintain any code locally, install any dependancies and makes the outputs easily sharable to a group of users.

Last weekend I decided to spend some time building a Slack Bot built around AWS Lambda functions and the AWS API Gateway.

Because chatbots require an endpoint to call back to, you either need a server which is constantly listening for api calls, or you can use a service like the API gateway, which takes its place. The volume to a bot that would require a full-time server dedicated to it would likely be quite high, so the API gateway (and by proxy, serverless compute in the form of AWS Lambda) make ideal candidates for such tools.

The biggest concern in untilizing these technologies is latency, as an always-on server will definitely be more responsive. That said, I tend to think that if you’re really concerned about latency <= 1000ms, a chatbot is probably the wrong solution anyway.

Moving on…  

I am of the (rather strong) opinion that one of the biggest barriers to entry in any open source project is the amount of work (read frustration) it takes for someone to get up and running with a palatable demo of the project. To this effect, when releasing something I will at least try to make an effort to make things as painless as possible.

Lambdabot follows this idea, in that the most painful part is actually running through the setup on the slack website to configure your bot. Once that is done, it should take about 5 commmands, most of which you can copy/paste, to get up and running.

Full code, plus a guide on setting up your bot in the slack api in the github repo: