Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chriszarate/slack-events-sns-command-example
Example Slack bot command implementation on AWS Lambda (via SNS)
https://github.com/chriszarate/slack-events-sns-command-example
Last synced: 14 days ago
JSON representation
Example Slack bot command implementation on AWS Lambda (via SNS)
- Host: GitHub
- URL: https://github.com/chriszarate/slack-events-sns-command-example
- Owner: chriszarate
- Created: 2017-04-22T23:08:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-23T20:45:43.000Z (over 7 years ago)
- Last Synced: 2024-10-19T04:53:16.738Z (25 days ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# An example Lambda function for a decoupled Slack bot
When [Slack events are forwarded to SNS][slack-events-sns], it makes it easy to
build small bots that respond to commands.1. Pick a command that you want your bot to respond to. For example, you might
want your bot to respond when users type `mybot ping`.2. Edit `index.js` to do something in response to that command.
3. Create a SNS topic corresponding to that command and subscribe your Lambda
function to it.You might need help with step 3—just ask your friendly neighborhood #bots
channel!## Events
See [Slack’s documentation][slack-events-docs] for an example of what’s included
in a Slack event.Since this code is only triggered if a user types a specific command, e.g.,
`mybot ping hello!`, some extra information is added to the event to help you
respond:```
{
...
command: {
subject: 'mybot',
verb: 'ping',
predicate: 'hello!'
}
}
```[slack-events-sns]: https://github.com/chriszarate/slack-events-sns-lambda
[slack-events-docs]: https://api.slack.com/events/message