GithubHelp home page GithubHelp logo

slackapi / template-terms-of-service Goto Github PK

View Code? Open in Web Editor NEW
34.0 8.0 25.0 248 KB

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

License: MIT License

JavaScript 100.00%
slack-blueprint slack-workflow-sample

template-terms-of-service's Introduction

Sending a Welcome Message to a New User

โœจ Updated December 2019: 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

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. If you are on Plus plan or Slack Enterprise Grid, you may use the SCIM API to disable the user's account.

term-of-service

Setup

Create a Slack app

  1. Create an app
  2. Enable Interactive components (See Enable Interactive Components below)
  3. Navigate to the OAuth & Permissions page and add the following bot token scopes:
    • chat:write, im:write, users:read
  4. Click 'Save Changes' and install the app (You should get an OAuth access token after the installation)
  5. Enable the events (See Enable the Events API below. It doesn't let you the Request URL until you run the code!)
  6. In your Slack workspace, invite the bot to #general, where the new user will join.

Run locally or Remix on Glitch

  1. Get the code
  2. Set the following environment variables to .env (see .env.sample):
    • SLACK_ACCESS_TOKEN: Your app's xoxb- token (available on the Install App page, after you install the app to a workspace once.)
    • SLACK_SIGNING_SECRET: Your app's Signing Secret (available on the Basic Information page)
  3. If you're running the app locally:
    • Start the app (npm start)

Enable the Events API

  1. Go back to the app settings and click on Events Subscriptions
  2. Set the Request URL to your server (e.g. https://yourname.ngrok.com) 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 server or Glitch URL + /interactive

template-terms-of-service's People

Contributors

aoberoi avatar colmdoyle avatar girliemac avatar pichsenmeister avatar sachinr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

template-terms-of-service's Issues

Dataerror

Hi I have got below error. Can you please help in identifying the root cause for this error. After the user is added i get this error. Has to do something with the user info verification.

Error:
NestedError: Can't find dataPath: /THJU1V9RS/UKKAYAEM8. Stopped at THJU1V9RS
at DataError.NestedError (C:\Slack_App\template-terms-of-service-master\node_modules\node-json-db\lib\Errors.js:7:25)
at new DataError (C:\Slack_App\template-terms-of-service-master\node_modules\node-json-db\lib\Errors.js:37:33)
at findData (C:\Slack_App\template-terms-of-service-master\node_modules\node-json-db\JsonDB.js:100:27)
at recursiveProcessDataPath (C:\Slack_App\template-terms-of-service-master\node_modules\node-json-db\JsonDB.js:127:17)
at JsonDB._getData (C:\Slack_App\template-terms-of-service-master\node_modules\node-json-db\JsonDB.js:140:16)
at JsonDB.getData (C:\Slack_App\template-terms-of-service-master\node_modules\node-json-db\JsonDB.js:70:21)
at Object.initialMessage (C:\Slack_App\template-terms-of-service-master\src\onboard.js:43:19)
at app.post (C:\Slack_App\template-terms-of-service-master\src\index.js:52:19)
at Layer.handle [as handle_request] (C:\Slack_App\template-terms-of-service-master\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Slack_App\template-terms-of-service-master\node_modules\express\lib\router\route.js:137:13)
name: 'DataError',
stack:
'NestedError: Can't find dataPath: /THJU1V9RS/UKKAYAEM8. Stopped at THJU1V9RS\n at DataError.NestedError (C:\Slack_App\template-terms-of-service-master\node_module

Test if working

Description

I set this up with glitch following the directions but when I've created test accounts, I don't seem to be getting a welcome message. I'd suggest you add some sort of test feature which could help identify common setup mistakes.

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.