This project enables you to create and extend a Slack bot with custom actions using AWS services.
It allows you to add actions easily by simply creating a folder in the actions directory.
Each action folder includes:
modal.json→ Defines the form displayed to users.buildspec.yaml→ Defines the backend commands executed by AWS CodeBuild.
This project consists of three main components:
- Contains the Python source code for the Slack bot.
- Includes
template.yamlfor deployment. - Reads configurations from the
actions/folder to present actions to users.
- Contains Terraform code to create AWS CodeBuild projects for each action.
- Each project corresponds to an action and executes the respective
buildspec.yaml.
- Contains individual action folders.
- Each action folder must include:
modal.json– Defines the Slack modal UI.buildspec.yaml– Defines the backend execution logic.
-
Create an Action Folder
- Under
bot/src/slack_bot/actions/, create a new folder (action name should be without spaces). - This name will be used for:
- The AWS CodeBuild project.
- The corresponding action in the Slack bot.
- Under
-
Define
modal.json- Use the Slack Block Kit Builder to create the modal UI.
- Save the JSON structure in
modal.jsoninside the action folder.
-
Define
buildspec.yaml- This file contains the commands executed by AWS CodeBuild.
- Define automation logic such as provisioning resources, executing scripts, or running other tasks.
- The bot presents a list of available actions based on the folders in the
actions/directory. - When a user selects an action, the corresponding
modal.jsonis displayed. - After submission, the bot triggers the AWS CodeBuild project defined in
buildspec.yaml.
- Modify
modal.jsonto change the form fields. - Update
buildspec.yamlto adjust the backend logic.
For more details on modals, check the Slack Block Kit Builder.
- Run the following command to deploy the bot and infrastructure:
make allThis command will:
- Deploy the CloudFormation stack (including the bot function and notifier function).
- Create the AWS CodeBuild projects ("Runners") using Terraform.
- Set the API Gateway URL in the Slash Command URL & Interactivity Request URL fields in the Slack App management console.
- Fill the secret that has been created (
/${BotName}/slack-secret-token) with the value:
{
"slack_signing_secret":"[PUT_HERE_SECRET]",
"slack_bot_token":"[PUT_HERE_TOKEN]"
}Contributions are welcome! Fork the repository and submit a pull request with bug fixes, improvements, or new features.
For more details, reach out to the repository owner. Visit Senora.dev💜 for more platform-related services.
