Integrate with Slack
Send customized Slack messages directly from a Next Matter workflow to dedicated channels.
Before you begin
Understand how data references work. See Use data references. This will help you use the captured data in the workflow steps.
Good to know: Check out our ready-made templates available when you add a step and select Templates > 3rd party templates. You can use the templates to create a set of pre-configured steps.
Need a specific template? Click the Contact us button in the top right of the page and let us know.
Create a Next Matter Bot in your Slack workspace
The bot should be authorized to send messages on behalf of Next Matter.
- Go to https://api.slack.com/apps?new_app=1. You might have to log in.
- Click Create an App and choose From scratch.
- Enter the app's name. It might be "Next Matter Bot".
- Select your workspace from the dropdown.
- Click Create App.
- In the Display Information section you can set App's logo. Use the Next Matter logo for the bot.
- In the Add features and functionality section, click Bots.
- Click Review Scopes to Add.
- Scroll down to Scopes. In the Bot Token Scopes, click Add and OAuth Scope.
- Add scopes one by one by selecting them from the dropdown. You need the following scopes:
- "channels:read"
- "channels:join"
- "chat:write"
- "chat:write.public"
- "users:read.email"
- Scroll up to OAuth Tokens for Your Workspace and click Install to Workspace.
- Click Allow.
- Copy and save the displayed token.
Get the channel ID
Note: If you don't have channels yet, create one in Slack.
- Go to https://api.slack.com/methods/conversations.list/test.
- In the Arguments section, paste the token in the Or, provide your own token field.
- Click Test Method.
- In the API response section, search for the name of the channel to place the bot. The ID of the channel will be in the line above the name. For example:
{"id": "CAQKA5GAW",
"name": "CHANNEL_NAME",
"is_channel": true,
"is_group": false,
"is_im": false
}
Add bot to channel
- Open your Slack app and select the channel to post messages.
- Click the gear icon in the top right corner of the channel.
- Click Add an App.
- Type "Next Matter" in the search bar.
- Click Add.
You should see a message in the channel that the bot has been added.
Configure the notification step in a process
- In your Next Matter portal, click Workflows, and then click the workflow you want to send messages to Slack.
- Click Edit workflow.
- Click +Add step and select Integration > Custom integration.
- Click Settings to configure the step.
- Enter the following details:
- Method: POST
- URL:
https://slack.com/api/chat.postMessage
- Headers: Content-Type: application/json
- Headers: Authorization:
Bearer BOT_TOKEN
.
Your entered details might look like the following:Bearer xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
- In the Body enter the values. For example, the body might look like the following.
{ "channel": "C04TYPWLF2Q", "text": "This is a line of text.\nAnd this is another one.\n\nThis is unquoted text\n>This is a sentence with some `inline *code*` in it.\n<{1. Enter all test details - URL - URL (plain)}" //this is a placeholder to replace }
- Save your changes.
Send a message to a user
As part of the workflow, you might want to send a Slack message to a specific user. The message will come from the customer’s Slack Next Matter App (see Create a Next Matter bot).
To send the message, you'll need an integration step to get the Slack user ID and a step to send the message to the owner of this ID.
You'll need a Slack token to authorize your calls. For moe on getting the token, see Slack documentation. The API token might look like the following:
xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
.
- Click +Add step and select Integration > Custom integration.
- Click Settings to configure the step.
- Enter the following details:
- Method: GET
- URL:
https://slack.com/api/users.lookupByEmail?email=USER_EMAIL
- Headers: Authorization:
Bearer BOT_TOKEN
.
Your entered details might look like the following:Bearer xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
- Body type: Form data
- Create a variable for the user ID with the value of
$.user.id
. - Save your changes.
- Now create a step to send the message. Again, click +Add step and select Integration > Custom integration.
- Click Settings to configure the step.
- Enter the following details:
- Method: POST
- URL:
https://slack.com/api/chat.postMessage
- Headers: Content-Type: application/json; charset=utf-8
- Headers: Authorization:
Bearer BOT_TOKEN
.
Your entered details might look like the following:Bearer xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
- In the Body enter the values. For example, the body might look like the following. To get the channel ID, see Get the Slack channel ID.
9.Save your changes.{ "channel": "CHANNEL_ID", "text": "This is a line of text.\nAnd this is another one.\n\nThis is unquoted text\n>This is a sentence with some `inline *code*` in it.\n<{1. Enter all test details - URL - URL (plain)}"//this is a placeholder }
Create a channel and invite users
You'll need a Slack token to authorize your calls. For moe on getting the token, see Slack documentation. The API token might look like the following:
xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
.
-
Click +Add step and select Integration > Custom integration.
-
Click Settings to configure the step.
-
Enter the following details:
- Method: POST
- URL:
https://slack.com/api/conversations.create
- Headers: Authorization:
Bearer BOT_TOKEN
.
Your entered details might look like the following:Bearer xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
- Content type: application/json; charset=utf-8
- Body:
{ "name":"CHANNEL_NAME_WITHOUT_#" //replace the placeholder with your data }
-
Create a variable for the channel ID with the value of
$.channel.id
. -
Save your changes.
-
To invite users to your channel, click +Add step and select Integration > Custom integration.
-
Click Settings to configure the step.
-
Enter the following details:
- Method: POST
- URL:
https://slack.com/api/conversations.invite
- Headers: Authorization:
Bearer BOT_TOKEN
.
Your entered details might look like the following:Bearer xoxb-364112219665-5014650446325-Pt0U8RutXz1FEwVLQpkj54lf
- Content type: application/json; charset=utf-8
- Body:
{ "channel": "{2. Create Slack Channel - Integration step - channel_id (plain)}",//this is data reference "users":["EMAIL_1", "EMAIL_2"]//enter the email addresses of the users to invite }
-
Create a variable for the channel ID with the value of
$.channel.id
. -
Save your changes.
Send a reminder
Before you begin
- You'll need to enter your Slack Team ID in the body of the send reminder call. To get the ID:
- Open any web browser and log in to your Slack account.
- Go to your workspace main page and check the URL in the search bar at the top.
- Copy the Team ID from the URL
- You'll need a Slack token to authorize your calls. For more on how to get the token, see Slack documentation.
Set up reminder
- Click +Add step and select Integration > Custom integration.
- Click Settings to configure the step.
- Enter the following details:
- Method: POST
- URL:
URL: https://slack.com/api/reminders.add
- Headers: Content-Type: application/json; charset=utf-8
- Headers: Authorization: Slack_API_Key
- Body:
{ "text": "REPLACE_WITH_REMINDER_TEXT", "time": "REPLACE_WITH_REMINDER_FREQUENCY", //for example, every weekday at 9:45am "team_id": "REPLACE_WITH_TEAM_ID" }
- Create a variable for the Slack reminder ID with the value of $reminder.id.
- Save your changes.
Stop the reminder
- Click +Add step and select Integration > Custom integration.
- Click Settings to configure the step.
- Enter the following details:
- Method: POST
- URL: https://slack.com/api/reminders.delete
- Headers: Content-Type: application/json; charset=utf-8
- Headers: Authorization: Slack_API_Key
- Body:
{ "reminder": "REPLACE_WITH_REMINDER_ID" // for example: Rm23456789; you can use data reference to the variable created when you set up the reminder }
- Create a variable for the Slack reminder ID with the value of $reminder.id.
- Save your changes.
Updated 29 days ago