โจ Updated August 2018: As we have introduced the workspace app (currently in beta), this tutorial and the code samples have been updated using the new token model! All the changes from the previous version of this example, read the DIFF.md
Learn more about the workspace app at the Slack API doc.
Use a slash command and a dialog to create a helpdesk ticket in a 3rd-party system. Once it has been created, send a message to the user with information about their ticket.
- Create a workspace app at https://api.slack.com/apps?new_app_token=1
- Add a Slash command (See Add a Slash Command section below)
- Enable Interactive components (See Enable Interactive Components below)
- Navigate to the OAuth & Permissions page and add the following scopes:
commands
users:read
users:read.email
chat:write
- Click 'Save Changes' and install the app (You should get an OAuth access token after the installation)
- Go back to the app settings and click on Slash Commands.
- Click the 'Create New Command' button and fill in the following:
- Command:
/helpdesk
- Request URL: Your ngrok or Glitch URL +
/command
- Short description:
Create a helpdesk ticket
- Usage hint:
[the problem you're having]
- Command:
- Save and reinstall the app
If you are using Glitch, the Request URL should look like: https://slack-slash-command-and-dialogs-blueprint.glitch.me/command
.
- Go back to the app settings and click on Interactive Components.
- Set the Request URL to your server (e.g.
https://yourname.ngrok.com
) or Glitch URL +/interactive-component
- Get the code
- Either clone this repo and run
npm install
- Or visit https://glitch.com/edit/#!/remix/slack-slash-command-and-dialogs-blueprint
- Either clone this repo and run
- Set the following environment variables to
.env
(see.env.sample
):SLACK_ACCESS_TOKEN
: Your app'sxoxa-
token (available on the **OAuth & Permissions once you install the app)SLACK_SIGNING_SECRET
: Your app's Signing Secret (available on the Basic Information page)
- If you're running the app locally, run the app (
npm start
)