/onboarding-example

A demonstration of how to build an onboarding app using Slack's Events API

Primary LanguageJavaScript

Slack Onboarding Example

This project demonstrates how to build an Onboarding App using Slack's Events API. It's meant to serve only as an example through code.

onboarding

Setup

Enable the Events

Updating the Script

The onboarding script is driven by onboarding.json. The app looks for events that match the event property in this JSON and marks it complete.

{
  "welcome": {
    "text": "Welcome to Slack! Get started by completing the steps below.",
    "attachments": [
      {
        "event": "star_added",
        "title": "Star a Message",
        "title_link": "https://get.slack.help/hc/en-us/articles/201331016-Using-stars",
        "text": "Stars are a way to mark an item in Slack as important. You can star channels or direct messages to move them to the top of your left sidebar, or star messages so you can easily come back to them later."
      },
      {
        "event": "reaction_added",
        "title": "Respond With a Reaction Emoji",
        "title_link": "https://get.slack.help/hc/en-us/articles/206870317-Emoji-reactions",
        "text": "You can quickly respond to any message on Slack with an emoji reaction. Reactions can be used for any purpose: voting, checking off to-do items, showing excitement."      
      },
      {
        "event": "pin_added",
        "title": "Pin a Message",
        "title_link": "https://get.slack.help/hc/en-us/articles/205239997-Pinning-messages-and-files",
        "text": "Important messages and files can be pinned to the details pane in any channel or direct message, including group messages, for easy reference."
      }
    ]
  }
}

Running Locally

Environment

This app requires two environment variables.

  • TOKEN - The Slack token used to post messages
  • PORT - The port to host the webserver on

WebServer

npm install
npm start

Tunneling

Using ngrok you can port a public url to your local server. After installing ngrok, you can get a url by running:

ngrok http 3000

You should get a response like this:

Tunnel Status                 online
Version                       2.1.3
Region                        United States (us)

Web Interface                 http://127.0.0.1:4040
Forwarding                    http://d8ab065c.ngrok.io -> localhost:3000
Forwarding                    https://d8ab065c.ngrok.io -> localhost:3000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00  

Use the Forwarding url as the base url of your Request URL on Slack's Event Subscription page.