Slack slash commands with delayed responses
This example project shows how to implement delayed responses to Slack slash commands. Slack limits the time to the first response to 3 seconds, so if you're trying to run a longer task, implementing everything in a single response won't work.
Slack Slash commands support delayed and multiple responses, allowing a bot to respond to a command up to 5 times in 30 minutes.
Claudia Bot Builder, since 1.4.0, offers a simple solution for delayed responses. This project demonstrates how to do that by implementing a simple alert timer. You can tell it how many seconds to wait, and it will ping you after that period.
How to run it
npm installto grab all the dependencies
npm run createto set up a Lambda function, and follow the instructions to connect it to Slack. (Refer to Setting up a Slack Slash Command if you need more info)
- In your Slack channel, Run
You'll see an immediate response that the timer is scheduled, and a delayed response 10 seconds later.
How it works
The code is in bot.js.
Check out the Delayed Responses to Slack Slash Commands Tutorial for a detailed explanation of how this code works.