Slack Module
  • 12 Sep 2023
  • 3 Minutes to read
  • Dark
    Light

Slack Module

  • Dark
    Light

Article summary

Overview

Module Details

Core or Github ModuleGithub Module
Restart Required? No
Steps Exposed?Yes
Step Location Integration > Slack Messenger
Settings Location N/A
Prerequisites
  • Slack account and application
  • Experience using OAuth and generating OAuth tokens in Decisions
  • Knowledge of Slack's API for correct scopes

The Slack Module allows a user to integrate the Slack application with Decisions. 

Depending on the permitted scopes provided to the Slack application, users will be able to create and archive channels, invite users into a channel, pin and unpin messages and delete messages sent by the application through Flows.

Installing the Slack module will add 13 steps to Integration > Slack Messenger.

Slack has two client types - Bot and User. Each has its own AccessToken. Bot clients are unable to use certain steps such as Search for Text in Channels and Create Channel. Setting up each type of client is broken out below.


Configuration of User Clients

First you need to register your client application.

  1. Go to https://api.slack.com/apps and login.
  2. Click Create New App.
  3. Give the app a name and assign it to a workspace.
  4. Click OAuth & Permissions located in the left menu.
  5. Under Scopes – User Token Scopes click Add an OAuth Scope and set the scopes. You can choose whichever scopes you desire from the list Slack provides. The recommended ones are: channels:history, channels:read, channels:write, chat:write, im:write, pins:write, search:read, users:read.
  6. At the top of the page, click Install to Workspace.
  7. Click Allow.

Create a provider for Slack OAuth in Decisions

  1. Go to System > Integration > OAuth > Providers , click ADD OAUTH PROVIDER
  2. Fill out the form. The below table lists URLs used for the integration:
    URLDescriptionExample
    Token Request URLThe Token Request URL found on Slack's API documentationhttps://slack.com/api/oauth.v2.access
    Authorize URLThe OAuth URL found in Slack's API documentationhttps://slack.com/oauth/v2/authorize
    Callback URLThe CallbackURL used to receive the token. This must be configured as the RedirectURL in Slack for the integration.[portalbaseurl]/HandleTokenResponse
  3. Client Id and Client Secret Key can be found under the Basic Information Page
  4. The other options can be left blank. Press SAVE when complete.

Get AccessToken in Decisions

  1. Go to System > Integration > OAuth > Tokens and click CREATE TOKEN.
  2. Set Token Name value.
  3. Choose the provider you have created.
  4. Set Additional values to user_scope=channels:history,channels:read,channels:write,chat:write,im:write,pins:write,search:read,users:read
  5. Click Request Token. A browser window will be open. Just follow the instructions in it.



Configuration of Bot Clients

This example will demonstrate how to configure the Slack Module. 

  1. Navigate to Slack in a browser and visit Slack's API page to create a new application.
  2. Select OAuth & Permissions.
  3. Under Bot Token Scopes, click Add an OAuth Scope. Listed below in the screenshot are some scopes recommended for use with Decisions.
  4. Once the Scopes have been configured, select Install to Workspace. 
  5. A prompt will requesting permission to install the app to the workspace. Click Allow. 
  6. In Decisions, create an OAuth Provider.
  7. Enter the values for the Token Request URL, Authorize URL, Callback URL, DefaultConsumer, and Secret keys. The below table lists URLs used for the integration:
    URLDescriptionExample
    Token Request URLThe Token Request URL found on Slack's API documentationhttps://slack.com/api/oauth.v2.access
    Authorize URLThe OAuth URL found in Slack's API documentationhttps://slack.com/oauth/v2/authorize
    Callback URLThe CallbackURL used to receive the token. This must be configured as the RedirectURL in Slack for the integration.[portalbaseurl]/HandleTokenResponse
    The Default Consumer Key and Default Consumer Secret Key can be located on Slack API for developers by clicking the Basic Information section. The fields are labeled as Client ID and Client Secret.


  8. Once the CallBackURL is configured in Decisions, define a RedirectURL that matches the CallbackURL within the application. This can be found under the OAuth & Permissions section.
  9. Create an OAuth Token.
  10. Enter a name for the token and select the Provider. Under Scope, enter the scopes defined under Bot Tokens. Click Request Token. Follow the instructions on the browser window and click OK when done.



Locating Slack Channel ID

The Slack Channel ID can be located in Slack by right clicking the channel > view channel details. In addition the Get Channel List and Get Channel ID by Name steps will also display the Channel ID as outputs. 


Steps

Step NameDescription
Archive Channel
Changes a channel's status to Archived meaning that no new messages can be added to it.
Create Channel
Allows a user to create a public or private channel.
Delete Message from Channel
Allows messages to be removed that were posted by the bot within the Slack application.
Get Channel Id by Name
Retrieves a Channel ID by inputting the channel name
Get Channel List
Returns a list of all channels created within the Slack workspace
Get Messages from Channel
Receives messages from the specified channel
Get User List in ChannelShows all the users in a particular channel.
Invite to ChannelInvite a Slack user to a channel.
Open Channel with Users
Create a Channel and invite users at the same time.
Pin Message to ChannelPins a message at the top of a channel, which makes it easier for users to view the message.
Post Message to ChannelSends a message to the specified channel as the integrated application
Search for Text in ChannelsReviews Channels for specified text.
Unpin Message to ChannelAllows a user to remove a pinned message from a channel.


For further information on Modules, visit the Decisions Forum.

Was this article helpful?

What's Next