The Hoedown Helper is a Slack App. It runs as a serverless function on AWS Lambda which only triggers when a message is posted to a channel that Hoedown Helper is part of.
At The Texas Tribune, reporters and editors often ask for help creating a good headline. The Hoedown Helper checks every message in the channel where those conversations happen for Style errors. If an error is found, it responds with the issue and a potential solution.
How to Create a Slack Bot using AWS Lambda in < 1 hour
Set the following environment variables in Lambda UI:
Variable | Description |
---|---|
AIRTABLE_API_KEY |
Airtable account API |
AIRTABLE_BASE_ID |
The Airtable Base ID for styleguide |
BOT_TOKEN |
Oauth & Permissions > Bot User OAuth Access Token (Copy everything after the "xoxb- ") |
SLACK_TOKEN |
Basic Information > App Credentials > Verification Token |
STYLEGUIDE_URL |
URL to Styleguide documentation (Google Doc, website, etc) |
- On the Slack API, click
start building
. - Enter the name of your app. We used
Hoedown Helper
and select the Slack you want to install the App on.
- Click on
OAuth & Permissions
and scroll to the bottom of the page where it says scopes. - Under
Bot Token Scopes
clickAdd an OAuth Scope
. - Select
channels:history
andchat:write
. - Scroll back to the top and click,
Install App to Workspace
. - Click
allow
. You will be return to the OAuth page. - At the top of the page there should be an access token. Copy everything that follows
xoxb-
This is yourBOT_TOKEN
and should be set in Lambda.
- Click on
Event Subscriptions
and enable events. - You will see a place to add your request url. Add the Lambda endpoint here. It should verify automatically.
- Once your url has been verified, open
Subscribe to bot events
and selectmessage.channels
.
- Open Slack and invite your bot to the channel it should be monitoring by calling it (i.e.
@hoedownhelper
)
Deploy to AWS Lambda function. If there are local changes in the Lambda UI not reflected in this repo, this will overwrite them.
# enter this directory
cd hoedown-helper
# install dependencies and deploy zipped package to aws lambda
make deploy