A general-purpose bot for the Rails Performance Slack.
Current capabilities:
- GitHub organization invites from Slack DMs
- Slack archive download links via presigned Cloudflare R2 URLs
- A built-in help command that lists every supported command
The bot only responds to Slack direct messages. All commands are case-insensitive.
Send either of the following messages to get the complete command list:
help
h
Send a GitHub username to get an invite to the GitHub organization:
<username>
or with the explicit prefix:
github join <username>
The bot looks up the username on GitHub and shows a confirmation prompt with Yes/No buttons. Clicking Yes sends the org invite. Each Slack user can only use this once.
Any of the following messages will return a presigned R2 download URL (valid for 7 days) for the latest Slack archive ZIP:
export
archive
slack export
slack archive
export please
archive please
please export
please archive
Trailing punctuation (!, ?, ., ,) is stripped before matching, so export!, archive?, and help! also work.
When the bot returns an error, it also reminds users that they can say help for the complete list of commands.
- A Slack workspace, where you can install and configure apps
- A GitHub org team and org, for inviting people to.
- Cloudflare R2, which we use as a source of truth for "who's already been invited", and for the archive artifact.
Create a Slack app at https://api.slack.com/apps and configure:
- Socket Mode: enabled
- OAuth scopes:
chat:writechat:write.publicim:historyim:readim:write
- Event Subscriptions:
message.im
- Interactivity: enabled (required for button actions)
- Install app to workspace and collect:
- Bot token (
xoxb-...) - App token (
xapp-...) - Signing secret
- Slack admin user ID (
U...)
- Bot token (
Create a personal access token with:
admin:orgread:user
Also gather:
- GitHub org name
- Team ID (numeric)
Use one credential pair for both operations:
- Generate presigned download URLs for archive ZIPs
- Read/write processed-user markers
Configure:
- Account ID
- Access key ID + secret access key
- Export bucket name (example:
railsperf-exports) and object key - Marker bucket name (example:
railsperf-processed-users)
For backup safety, enable versioning on the marker bucket.
Copy the template:
cp .env.example .envSet required values:
SLACK_BOT_TOKEN=xoxb-your-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_APP_TOKEN=xapp-your-token
SLACK_ADMIN_USER_ID=U0123456789
GITHUB_TOKEN=your-github-token
GITHUB_ORG=your-org
GITHUB_TEAM_ID=123456
R2_ACCOUNT_ID=your-cloudflare-account-id
R2_ACCESS_KEY_ID=your-r2-access-key-id
R2_SECRET_ACCESS_KEY=your-r2-secret-access-key
R2_BUCKET=railsperf-exports
R2_MARKERS_BUCKET=railsperf-processed-users
NODE_ENV=developmentOptional:
R2_OBJECT_KEY=railsperf-export-latest.zip
R2_REGION=auto
LOG_LEVEL=infoContributions are welcome. Open an issue or pull request.
MIT (see LICENSE).