{"id":15714291,"url":"https://github.com/slack-samples/javascript-announcement-bot","last_synced_at":"2025-07-22T11:07:27.744Z","repository":{"id":53583296,"uuid":"91861487","full_name":"slackapi/template-announcement-approvals","owner":"slackapi","description":"Sample Slack app that uses the Events API and interactive message to implement an approvals workflow","archived":false,"fork":false,"pushed_at":"2021-03-11T09:48:33.000Z","size":8176,"stargazers_count":74,"open_issues_count":6,"forks_count":36,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-04T21:35:46.609Z","etag":null,"topics":["slack-api","slack-blueprint","slack-tutorial","slack-workflow-sample"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/slackapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-20T03:03:22.000Z","updated_at":"2024-09-27T10:56:14.000Z","dependencies_parsed_at":"2022-09-11T07:21:24.490Z","dependency_job_id":null,"html_url":"https://github.com/slackapi/template-announcement-approvals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Ftemplate-announcement-approvals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Ftemplate-announcement-approvals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Ftemplate-announcement-approvals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Ftemplate-announcement-approvals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slackapi","download_url":"https://codeload.github.com/slackapi/template-announcement-approvals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869309,"owners_count":16555579,"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":["slack-api","slack-blueprint","slack-tutorial","slack-workflow-sample"],"created_at":"2024-10-03T21:35:51.334Z","updated_at":"2025-07-22T11:07:24.063Z","avatar_url":"https://github.com/slackapi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \"AnnounceBot\" Approval Workflows with Modal\n\n\n\u003e :sparkles: *Updated October 2020: As we have introduced some new features, this tutorial and the code samples have been updated! All the changes from the previous version of this example, read the [DIFF.md](diff.md)*\n\n---\n\nThis app lets its bot to post an approved message into a public channel- A user DMs to bot to create an announcement, and once it is approved by another user, the message will be posted to public.\n\nUser A (\"girlie_mac\") wants to announce about donuts on `#random` channel, and User B (\"Slack Boss\") approves it:\n\n![announcements_approvals](images/demo_approval_flow.gif)\n\n## API \u0026 Features\n\nThis app uses:\n- Web API\n    - `chat.postMessage` to post messages\n    - `conversations.open` to send direct messages from the bot to a user\n    - `users.conversations` to get channels the bot user is a member of\n    - `views.publish` to publish a view to the Home tab\n    - `views.open` to open a Block Kit modal and collect information for the announcement to be sent\n    - `conversations.history` to view historical messages between the bot and user\n- Events API `message.im` to see when a DM message is sent\n- Block Kit messages with interactive buttons\n- Block Kit Modals API with dynamic menus\n\n## Setup\n\n### 1. Clone this repo, or Remix this Glitch repo\n\nClone the repo (then `npm install` to install the dependencies), or if you'd like to work on Glitch, remix from the button below:\n\n[![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/remix/slack-announcements-approval-blueprint)\n\n#### 2. Create a Slack app\n\n1. Create an app at [api.slack.com/apps](https://api.slack.com/apps)\n2. Navigate to the OAuth \u0026 Permissions page and add the following Bot token scopes:\n    * `channels:read`\n    * `chat:write`\n    * `im:write`\n    * `im:history`\n3. Enable the events (See below *Enable the Events API*)\n4. Enable the interactive messages (See below *Enable Interactive Messages*)\n5. Enable App Home (See below *App Home*)\n6. Click 'Save Changes' and install the app (You should get an OAuth access token after the installation\n\n#### Enable the Events API\n1. Click on **Events Subscriptions** and enable events.\n2. Set the Request URL to your server (or Glitch URL) + `/events` (*e.g.* `https://your-server.com/events`)\n3. On the same page, go down to **Subscribe to Bot Events** section and subscribe to these events \n    - `message.im` \n    - `app_home_opened`\n4. Save\n\n#### Enable Interactive Messages\n\nTo enable interactive UI components (This example uses buttons):\n\n1. Click on **Interactive Components** and enable the interactivity.\n2. Set the Request URL to your server (or Glitch URL) + `/interactions`\n\nTo dynamically populate a drop-down menu list in a dialog (This example uses a list of channels):\n\n1. Insert the Options Load URL (*e.g.* `https://your-server.com/options`) in the **Message Menus** section\n2. Save\n\n#### Enable App Home\n\nTo enable App Home:\n\n1. Click on **App Home** and make sure both `Home Tab` and `Messages Tab` are enabled.\n\n#### 3. Run this App\nSet Environment Variables and run:\n\n1. Set the following environment variables in `.env` (copy from `.env.sample`):\n    * `SLACK_ACCESS_TOKEN`: Your app's `xoxb-` token (available on the Install App page after the installation)\n    * `SLACK_SIGNING_SECRET`: Your app's Signing Secret (available on the **Basic Information** page)\n2. If you're running the app locally:\n    * Start the app (`npm start`)\n\nOn Slack client, \"invite\" your bot to appropriate channels. The bot cannot post messages to the channels where the bot is not added.\n\n## The app sequence diagram\n\n![dialog](images/diagram_approval_flow.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-samples%2Fjavascript-announcement-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslack-samples%2Fjavascript-announcement-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-samples%2Fjavascript-announcement-bot/lists"}