/template-terms-of-service

Sample Slack app that uses the Events API and interactive messages to send new users a Terms of Service or welcome message

Primary LanguageJavaScriptMIT LicenseMIT

Slack Terms of Service / Welcome message template

Sample Slack app that presents a Terms of Service (or any other message) when a new user joins a team.

The user can accept the Terms of Service using message buttons. If a user has been presented with the Terms before and they haven't accepted, a background job can send them a reminder after a specific period of time. Eventually you can use the SCIM API to disable the user's account.

term-of-service

Setup

Create a Slack app

  1. Create an app at api.slack.com/apps
  2. Navigate to the Bot Users page and add a bot user
  3. Navigate to the Install App page and install the app
  4. Copy the xoxb- token after the installation process is complete

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 (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 want to run the web server on
  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 team_join team events

Enable Interactive Messages

  1. In the app settings, click on Interactive Messages
  2. Set the Request URL to your ngrok or Glitch URL + /interactive-message