{"id":28388111,"url":"https://github.com/slack-ruby/slack-ruby-bot-server-events-sample","last_synced_at":"2025-06-27T05:32:39.201Z","repository":{"id":38027470,"uuid":"280891220","full_name":"slack-ruby/slack-ruby-bot-server-events-sample","owner":"slack-ruby","description":"Sample for slack-ruby-bot-server-events.","archived":false,"fork":false,"pushed_at":"2023-04-01T14:26:59.000Z","size":1039,"stargazers_count":26,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-10T04:03:33.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slack-ruby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-19T15:12:22.000Z","updated_at":"2025-03-30T03:23:41.000Z","dependencies_parsed_at":"2022-08-29T18:10:33.298Z","dependency_job_id":null,"html_url":"https://github.com/slack-ruby/slack-ruby-bot-server-events-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/slack-ruby/slack-ruby-bot-server-events-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-ruby%2Fslack-ruby-bot-server-events-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-ruby%2Fslack-ruby-bot-server-events-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-ruby%2Fslack-ruby-bot-server-events-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-ruby%2Fslack-ruby-bot-server-events-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slack-ruby","download_url":"https://codeload.github.com/slack-ruby/slack-ruby-bot-server-events-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-ruby%2Fslack-ruby-bot-server-events-sample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262198161,"owners_count":23273807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T20:12:11.139Z","updated_at":"2025-06-27T05:32:39.191Z","avatar_url":"https://github.com/slack-ruby.png","language":"Ruby","readme":"\nSlack Ruby Bot Server Events Sample\n===================================\n\n[![test](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample/actions/workflows/test.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample/actions/workflows/test.yml)\n\n- [Slack Ruby Bot Server Events Sample](#slack-ruby-bot-server-events-sample)\n  - [What is this?](#what-is-this)\n  - [Running the Sample](#running-the-sample)\n    - [Settings](#settings)\n    - [Install App](#install-app)\n    - [OAuth Scopes](#oauth-scopes)\n    - [Events](#events)\n    - [Slash Commands](#slash-commands)\n    - [Actions](#actions)\n    - [Copyright \u0026 License](#copyright--license)\n\n## What is this?\n\nA sample app that uses [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to implement and respond to [Slack Events API](https://api.slack.com/events-api), [Interactive Message Buttons](https://api.slack.com/legacy/message-buttons) and [Slash Commands](https://api.slack.com/interactivity/slash-commands).\n\n## Running the Sample\n\n### Settings\n\nCreate `.env` file with the following settings.\n\n```\nSLACK_CLIENT_ID=...\nSLACK_CLIENT_SECRET=...\nSLACK_SIGNING_SECRET=...\nSLACK_VERIFICATION_TOKEN=...\n```\n\nGet the values from from [your app's](https://api.slack.com/apps) _Basic Information_ settings.\n\nRun `bundle install` and `foreman start`.\n\n### Install App\n\nRegister your app via OAuth workflow from [localhost:5000](http://localhost:5000).\n\nExpose the local server port 5000 to receive Slack events using [ngrok](https://ngrok.com).\n\n```\nngrok http 5000\n```\n\nCopy the URL, e.g. `https://79f0f6335438.ngrok.io`, and use it as the prefix for your events, slash commands, and interactive message buttons.\n\n### OAuth Scopes\n\nSee [config/initializers/slack_ruby_bot_server.rb](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.\n\n### Events\n\nSet the _Request Url_ in your app's Features under _Event Subscriptions_, e.g. `https://79f0f6335438.ngrok.io/api/slack/event`. When you change this URL, Slack will `POST` a verification challenge to `/api/slack/event`, which should succeed.\n\n![](screenshots/events.png)\n\nSubscribe to `member_joined_channel` and `member_left_channel` events.\n\n![](screenshots/events-subscribe.png)\n\nInvite the bot to a channel. Add/remove some other members. The welcome message is [posted from lib/events/member_joined_channel.rb](lib/events/member_joined_channel.rb) every time a user joins.\n\n![](screenshots/events-demo.gif)\n\nA default handler is also fired on all other events in [lib/events/default.rb](lib/events/default.rb) producing log output.\n\n```\n11:49:56 web.1  | I, [2020-07-19T11:49:56.933931 #72370]  INFO -- : Successfully connected team dblock (T04KB5WQH) to https://dblockdotorg.slack.com.\n11:53:10 web.1  | I, [2020-07-19T11:53:10.607301 #72370]  INFO -- : User test_app joined events.\n11:53:17 web.1  | I, [2020-07-19T11:53:17.786968 #72370]  INFO -- : User dblockplayplay joined events.\n```\n\n### Slash Commands\n\nCreate a `/ping` Slash command. Set the _Request URL_, e.g. `https://79f0f6335438.ngrok.io/api/slack/command`.\n\n![](screenshots/slash-commands-ping.png)\n\n![](screenshots/slash-commands-ping-edit.png)\n\nThere's no need to invite the bot to a channel. Try `/ping`, the bot will respond with `pong` from [lib/slash_commands/ping.rb](lib/slash_commands/ping.rb).\n\n![](screenshots/slash-commands-demo.gif)\n\nA default handler is also fired on all other slash commands in [lib/slash_commands/default.rb](lib/slash_commands/default.rb) producing log output.\n\n```\n20:17:02 web.1  | I, [2020-07-19T20:17:02.678409 #77259]  INFO -- : Successfully connected team dblock (T04KB5WQH) to https://dblockdotorg.slack.com.\n20:17:05 web.1  | I, [2020-07-19T20:17:05.703699 #77259]  INFO -- : Received a ping.\n```\n\n### Actions\n\nSet the _Request Url_ in your app's Features under _Interactivity \u0026 Shortcuts_, e.g. `https://79f0f6335438.ngrok.io/api/slack/action`. Create an \"on messages\" shortcut, set the ID to `count-letters`.\n\n![](screenshots/actions-create.png)\n\nThere's no need to invite the bot to a channel. Choose the \"Count Letters\" shortcut, the bot will respond with an ephemeral message from [lib/actions/count_letters.rb](lib/actions/count_letters.rb).\n\n![](screenshots/actions-demo.gif)\n\nA default handler is also fired on all other actions in [lib/actions/default.rb](lib/actions/default.rb) producing log output.\n\n```\n23:42:21 web.1  | I, [2020-07-19T23:42:21.394965 #78955]  INFO -- : Successfully connected team dblock (T04KB5WQH) to https://dblockdotorg.slack.com.\n23:43:43 web.1  | I, [2020-07-19T23:43:43.978877 #78955]  INFO -- : Counting letters in \"The red brown fox jumped over a lazy dog.\"\n```\n\n### Copyright \u0026 License\n\nCopyright [Daniel Doubrovkine](http://code.dblock.org), 2020\n\n[MIT License](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-ruby%2Fslack-ruby-bot-server-events-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslack-ruby%2Fslack-ruby-bot-server-events-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-ruby%2Fslack-ruby-bot-server-events-sample/lists"}