A Slack bot for tracking answers to true/false trivia questions. Designed for use with a Fact or Crap desk calendar available from calendars.com. Built with serverless technologies from AWS: Lambda, API Gateway, and DynamoDB.
- A Slack account with permission to install apps
- An AWS account with permission to create resources
- An AWS CLI profile setup with AWS account credentials
- Node.js installed
- Open a browser and navigate to https://api.slack.com/apps
- Click "Create New App".
- Enter the name "Trivial Bot"
- Slect a Slack workspace
- Click "Create App"
- In left panel, select "Bot Users"
- Click "Add a Bot User"
- Enter "trivial" for "Display name" and "Default username"
- Toggle on "Always Show My Bot as Online"
- Click "Add Bot User"
- In left panel, select "Install App"
- Click "Install App to Workspace"
- Review permissions and click "Allow"
- Record value of "Bot User OAuth Access Token"
- In left pannel, select "Basic Information"
- Under "App Credentials" click "Show" for "Signing Secret" and record value
- Open a shell and navigate to root of repo
- Run the command:
npm install
- Run the command:
npm run sls -- deploy --token <token> --signing-secret <secret> --profile <profile> --region <region> --stage <stage>
- Open a browser and navigate to AWS console
- Navgiate to API Gateway service
- Select API Gateway instance for bot
- In left panel, select "Stages" then bot's stage name
- Record "Invoke URL"
- Return to https://api.slack.com/apps and the newly created app
- In left panel, select "Event Subscriptions"
- Toggle on "Enable Events"
- Enter "
<invoke-url>/event
" for "Request URL" - Expand "Subscribe to bot events"
- Click "Add Bot User Event"
- Select "app_mention" event
- Click "Save Changes"
- In left pannel, select "Slash Commands"
- Click "Create New Command"
- Enter "/trivial" for "Command"
- Enter "
<invoke-url>/command
" for "Request URL" - Enter "Start or end a round of trivia" for "Short Description"
- Enter "[help] or [create] or [close]" for "Usage Hint"
- Click "Save"
- In left panel, select "Interactive Components"
- Toggle on "Interactivity"
- Enter "
<invoke-url>/action
" for "Request URL" - Click "Save Changes"
- Test the bot by mentioning
@trivial
in Slack
- Open a shell and navigate to root of repo
- Run the command:
npm run sls -- deploy --token <token> --signing-secret <secret> --profile <profile> --region <region> --stage <stage>
- Open a shell and navigate to root of repo
- Run the command:
npm run sls -- remove --token <token> --signing-secret <secret> --profile <profile> --region <region> --stage <stage>
- Open a broweser and nvaigate to https://api.slack.com/apps and the previously created app
- In left pannel, select "Basic Information"
- At the bottom, click "Delete App"