A sample app that uses slack-ruby-bot-server-events-app-mentions to implement and respond to bot mention and im events.
Create .env
file with the following settings.
SLACK_CLIENT_ID=...
SLACK_CLIENT_SECRET=...
SLACK_SIGNING_SECRET=...
SLACK_VERIFICATION_TOKEN=...
Get the values from from your app's Basic Information settings.
Run bundle install
and foreman start
.
Register your app via OAuth workflow from localhost:5000.
Expose the local server port 5000 to receive Slack events using ngrok.
ngrok http 5000
Copy the URL, e.g. https://79f0f6335438.ngrok.io
, and use it as the prefix for your events, slash commands, and interactive message buttons.
See config/initializers/slack_ruby_bot_server.rb for the required OAuth scopes. If you get Slack::Web::Api::Errors::MissingScope: missing_scope
errors, you are missing a scope in your app configuration.
Copyright Daniel Doubrovkine, 2020