The goal of this repo is to be a boilerplate for anyone who would like to deploy a simple slack list bot to AWS and set it up with Slack.
With this app, we want to:
- Persist a multiple list database
- Support following commands:
- Show list
- Add to list
- Remove from list
- Clear list
- Help with list commands
- Create an endpoint to manage the list in the cloud
- Create a slack command to help teams create/maintain lists
Before you get started, make sure you have access to the following
- Nodejs
- Yarn
- AWS Account (~ $2.60/month)
- Serverless Account (FREE)
- Slack workspace
Ensure your node
version is v14.x
or above
$ yarn install
After you create your Serverless account, with the command below you'll be asked to login
$ yarn serverless
You may need to install Java SE8 for local dynamodb to work
$ yarn serverless dynamodb install
$ yarn start
Follow this great serverless article to help you get your AWS credentials
All you need to do now is to deploy with serverless, and it handles the rest! Database and lambdas will be created for you and you'll get API endpoints!
$ yarn serverless deploy
Now the fun part!
Now that you have an endpoint, we'll now create a Slack App. First you will go to https://api.slack.com/apps/ and click on Create New App
select "From an app manifest". It's in beta but should work just fine.
Copy and paste the below manifest into the step where it asks for it. (Be sure to fill in the missing data)
{
"_metadata": {
"major_version": 1,
"minor_version": 1
},
"display_information": {
"name": "Lists"
},
"features": {
"bot_user": {
"display_name": "MyBot",
"always_online": false
},
"slash_commands": [
{
"command": "/list",
"url": "<YOUR_NEW_ENDPOINT_HERE>",
"description": "Create list of items (todos, topics, etc)",
"usage_hint": "help",
"should_escape": false
}
]
},
"oauth_config": {
"scopes": {
"bot": [
"commands"
]
}
},
"settings": {
"org_deploy_enabled": false,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}
Once the app is created, all that is left is to install the app into your workspace (should be prompted for this after wizard).
Now you should be able to go into any channel and send the following message:
/list show
🥳🥳🥳