- 12 Sep 2023
- 3 Minutes to read
- Print
- DarkLight
Slack Module
- Updated on 12 Sep 2023
- 3 Minutes to read
- Print
- DarkLight
Overview
Module Details | |
Core or Github Module | Github Module |
Restart Required? | No |
Steps Exposed? | Yes |
Step Location | Integration > Slack Messenger |
Settings Location | N/A |
Prerequisites |
|
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.
- Go to https://api.slack.com/apps and login.
- Click Create New App.
- Give the app a name and assign it to a workspace.
- Click OAuth & Permissions located in the left menu.
- 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.
- At the top of the page, click Install to Workspace.
- Click Allow.
Create a provider for Slack OAuth in Decisions
- Go to System > Integration > OAuth > Providers , click ADD OAUTH PROVIDER
- Fill out the form. The below table lists URLs used for the integration:
URL Description Example Token Request URL The Token Request URL found on Slack's API documentation https://slack.com/api/oauth.v2.access Authorize URL The OAuth URL found in Slack's API documentation https://slack.com/oauth/v2/authorize Callback URL The CallbackURL used to receive the token. This must be configured as the RedirectURL in Slack for the integration. [portalbaseurl]/HandleTokenResponse - Client Id and Client Secret Key can be found under the Basic Information Page
- The other options can be left blank. Press SAVE when complete.
Get AccessToken in Decisions
- Go to System > Integration > OAuth > Tokens and click CREATE TOKEN.
- Set Token Name value.
- Choose the provider you have created.
- Set Additional values to user_scope=channels:history,channels:read,channels:write,chat:write,im:write,pins:write,search:read,users:read
- 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.
- Navigate to Slack in a browser and visit Slack's API page to create a new application.
- Select OAuth & Permissions.
- Under Bot Token Scopes, click Add an OAuth Scope. Listed below in the screenshot are some scopes recommended for use with Decisions.
- Once the Scopes have been configured, select Install to Workspace.
- A prompt will requesting permission to install the app to the workspace. Click Allow.
- In Decisions, create an OAuth Provider.
- 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:
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.URL Description Example Token Request URL The Token Request URL found on Slack's API documentation https://slack.com/api/oauth.v2.access Authorize URL The OAuth URL found in Slack's API documentation https://slack.com/oauth/v2/authorize Callback URL The CallbackURL used to receive the token. This must be configured as the RedirectURL in Slack for the integration. [portalbaseurl]/HandleTokenResponse - 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.
- Create an OAuth Token.
- 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 Name | Description |
---|---|
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 Channel | Shows all the users in a particular channel. |
Invite to Channel | Invite a Slack user to a channel. |
Open Channel with Users | Create a Channel and invite users at the same time. |
Pin Message to Channel | Pins a message at the top of a channel, which makes it easier for users to view the message. |
Post Message to Channel | Sends a message to the specified channel as the integrated application |
Search for Text in Channels | Reviews Channels for specified text. |
Unpin Message to Channel | Allows a user to remove a pinned message from a channel. |