Slack Bot Using AWS API Gateway and AWS Lambda

Internally over here in Tech in Asia, we use Slack for communications.

Even between Li Xiang and I, we use Slack for communications.

So I wanted to create a Slack Bot to do tasks for me when I type something.

I used to host it on my own VPS here in lesterchan.net but I decided to move it to Amazon Web Services (AWS) because it definitely has better uptime than my own server running the Node.js application using forever.

I chose Asia Pacific (Tokyo) region for AWS Lambda and Asia Pacific (Singapore) region for AWS API Gateway. AWS Lambda is not yet available in Singapore (I am hoping it will come to Singapore soon)

I decided to open source it and hence you can head over to the GitHub Repo at github.com/lesterchan/slack-bot to view the step-by-step tutorial.

There are five commands so far:

  • Singapore Bus Arrival Timings: bus <busStopNo> <busNo>, example: bus 1039 61
  • Singapore Haze Situation: haze
  • Singapore Weather 3 Hour Forecast: weather
  • IP Information: ipinfo <ip>, example: ipinfo 8.8.8.8
  • Social Stats Count For Links: socialstats <url>, example: socialstats https://lesterchan.net

Slack Bot
Slack Bot

Credits to Ryan Ray’s Serverless Slack Integrations with node.js, AWS Lambda, and AWS API Gateway for the inspiration.

You Might Also Be Interested In