A personal Slack bot to handle miscellaneous tasks hosted on AWS Lambda.
| Command | Description |
|---|---|
/coinflip |
Flips a coin |
/delayed-ping |
Ping with a delay |
/echo |
Opens a Slack modal to echo a text to the output channel |
/menu |
Opens a Slack modal to select options and sends the result to the output channel |
/ping |
Ping |
/roll |
Rolls a dice with modifiers |
From the project home directory:
- Endpoint Function:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags lambda.norpc -o binary/bootstrap ./cmd/endpoint/ - Task Function:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags lambda.norpc -o binary/bootstrap ./cmd/task/
Zip the bootstrap binaries and upload it to the Lambda functions.
| Name | Description |
|---|---|
DEBUG |
Enable debug mode |
TASK_FUNCTION_NAME |
Name of the Task Lambda Function |
SLACK_SIGNING_SECRET |
Slack App's Signing Secret |
SLACK_OAUTH_TOKEN |
Slack App's OAuth Token |
SLACK_HISTORY_CHANNEL_ID |
Slackingway's History Channel ID |
SLACK_OUTPUT_CHANNEL_ID |
Slackingway's Output Channel ID |
ADMIN_ROLE_USERS |
Comma-delimited string of Slack User IDs with admin roles |
| Name | Description |
|---|---|
DEBUG |
Enable debug mode |
SLACK_OAUTH_TOKEN |
Slack App's OAuth Token |
SLACK_HISTORY_CHANNEL_ID |
Slackingway's History Channel ID |
SLACK_OUTPUT_CHANNEL_ID |
Slackingway's Output Channel ID |
To quickly spin up slackingway-bot on AWS, use the Terraform module.
- Create the endpoint Lambda function on AWS.
- For the
Runtime, selectAmazon Linux 2023. - For the
Architecture, selectx86_64.
- For the
- Add an API Gateway triger to the endpoint Lambda function.
- Use the following settings:
- Intent: Create a new API
- API type: REST API
- Security: Open
- Use the following settings:
- Create the task Lambda function on AWS.
- For the
Runtime, selectAmazon Linux 2023. - For the
Architecture, selectx86_64.
- For the
- Build the endpoint and task binaries.
- Archive the
bootstrapbinaries in .zip files and upload it to the Lambda functions. - In the
Configurationtab, add in the required environment variables to the Lambda functions. - Change the
Timeoutof the task Lambda function to a value greater than 3 seconds.- The
Timeoutof the endpoint Lambda function can stay as 3 seconds to follow Slack's requirements.
- The
Get the endpoint Lambda API Gateway triggers's API endpoint and add it to the Slack apps's Request URL in each Slack Slash Command in the Slack API page.
Save the Bot User OAuth Token as the SLACK_OAUTH_TOKEN environment variable in the task Lambda function.
Enable the following Bot Token Scopes:
channels:historychat:writechat:write.customizecommandsim:historyusers.profile:readusers:read
Get the endpoint Lambda API Gateway triggers's API endpoint and add it to the Slack apps's Request URL. It should be verified after a second.
Add the following bot user events:
app_home_opened
