All Projects → slackapi → template-channel-webhooks

slackapi / template-channel-webhooks

Licence: MIT license
Sample Slack app that uses a Bot to create per-channel webhooks

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to template-channel-webhooks

template-announcement-approvals
Sample Slack app that uses the Events API and interactive message to implement an approvals workflow
Stars: ✭ 73 (+170.37%)
Mutual labels:  slack-blueprint
template-actionable-notifications
Sample Slack app to illustrate how incoming webhooks and interactive messages can be used to build a helpdesk integration
Stars: ✭ 31 (+14.81%)
Mutual labels:  slack-blueprint
template-action-and-dialog
A sample Slack app "ClipIt", which allows user to clip a message using a message action
Stars: ✭ 24 (-11.11%)
Mutual labels:  slack-blueprint

Per-channel webhook template

A bot that creates an incoming webhook URL for every channel it joins. Using the webhook URL, any user can set up integrations to post notifications into that channel.

channel-webhook-template

Setup

Create a Slack app

  1. Create an app at api.slack.com/apps
  2. Click on Bot Users
  3. Add a bot user (choose a username and enable 'Always Show My Bot as Online')
  4. Click on Install App in the sidebar
  5. Install the app and copy the xoxb- token

Run locally or Remix on Glitch

  1. Get the code
  2. Set the following environment variables to .env (see .env.sample):
    • SLACK_TOKEN: Your app's xoxb- token value (available on the Install App page)
    • SLACK_VERIFICATION_TOKEN: Your app's verification token (available on the Basic Information page)
    • PORT: The port that you're running ngrok on
    • BASE_URL: Your ngrok URL
  3. If you're running the app locally:
    1. Start the app (npm start)
    2. In another windown, start ngrok on the same port as your webserver (ngrok http $PORT)

Enable the Events API

  1. Go back to the app settings and click on Events Subscriptions.
  2. Set the Request URL to your ngrok or Glitch URL + /events
  3. On the same page, subscribe to the member_joined_channel bot event

In Slack

  1. Invite the bot into a channel. You should see a message posted with the webhook URL
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].