This document outlines the steps for setting up, deploying, and managing an internal Slack bot. The bot is designed to be hosted on AWS Lambda and works with Google Sheets via a service account. Below you'll find guidelines for local debugging, deploying via Terraform, and incorporating CI/CD through GitHub Actions.
- Navigate to Slack API Portal
- Click on "Create an app" and choose "From Scratch."
- Complete the required fields.
- Remember to save your changes regularly.
- Under 'Settings' → 'Basic Information', you can customize the bot's icon, name, and description.
-
Visit 'Features' → 'OAuth & Permissions'.
-
In the 'Scopes' section, add the following OAuth scopes:
- channels:history
- channels:manage
- channels:read
- chat:write
- and others (see original README for complete list)
-
Retrieve your 'Bot User OAuth Access Token' and set it as an environment variable
SLACK_BOT_TOKEN
. -
Obtain the 'Signing Secret' from 'Settings' → 'Basic Information', and set it as
SLACK_SIGNING_SECRET
.
- Install the bot into your workspace and grant the necessary permissions.
- Go to 'Features' → 'Event Subscriptions' and set the Request URL to your Lambda URL.
- Subscribe the bot to events like
message.channels
,message.groups
, etc.
- In 'Features' → 'Interactivity & Shortcuts', set the Request URL to your Lambda URL.
- Under 'Slash Commands', define commands such as
/vacation
and/ooo-today
.
- In 'Features' → 'App Home', enable the Home and Message Tabs.
- Add the bot to the manager approval channel for posting messages.
- Set your environment variables as outlined in
variables.tf
. - Have Docker installed.
- Pull the Docker image:
docker pull lambci/lambda:build-python3.8
. - Initialize your Terraform backend and apply the configuration.
- Run
local_run.py
. - Use tools like ngrok for tunneling.
The bot currently supports /vacation
and /ooo-today
.
Add the specified secrets under 'Repo Settings' → 'Secrets' → 'Action'.
Follow the steps in the original README to create a CI user for deployments.
Feel free to open pull requests or issues for significant changes. Remember to update the tests accordingly.
Licensed under the MIT License.