Serverless Slack Chatbot

  1. Go to the slack app https://api.slack.com/apps
  2. Create a slack app and choose where you want to keep your app in the workspace then click Create App
  1. Install Serverless framework on your local machine
npm install serverless -g
serverless create --template aws-nodejs --path serverless-slack-chatbot 
serverless framework project created
npm init
npm i @slack/bolt @slack/web-api @slack/webhook serverless-http
SLACK_CLIENT_ID=abc
SLACK_API_TOKEN=abc
SLACK_CLIENT_SECRET=abc
SLACK_BOT_TOKEN=xoxb-
SLACK_SIGNING_SECRET=abc
sls deploy -v 
  1. Go to Event Subscriptions and turn it on then pass endpoint on Request URL. In this case, we are using an endpoint that end with slack/events. if everything is right, you should get a green text verified.
  1. Go to slash commands and click create a new command
  2. add command that you’d like to use, request url is the same as event subscritpions and short description.
  3. hit save button and reinstall your app
slack slash commands
slack slash commands
Nadtakan Futhoem — Sr. Software Engineer

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store