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.

  1. Go to https://api.slack.com/apps?new_app=1. You might have to log in.
  2. Click Create an App and choose From scratch.
  3. Enter the app's name. It might be "Next Matter Bot".
  4. Select your workspace from the dropdown.
  5. Click Create App.
  6. In the Display Information section you can set App's logo. Use the Next Matter logo for the bot.
  7. In the Add features and functionality section, click Bots.
  8. Click Review Scopes to Add.
  9. Scroll down to Scopes. In the Bot Token Scopes, click Add and OAuth Scope.
  10. 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"
  11. Scroll up to OAuth Tokens for Your Workspace and click Install to Workspace.
  12. Click Allow.
  13. Copy and save the displayed token.

Get the channel ID

πŸ“˜

Note: If you don't have channels yet, create one in Slack.

  1. Go to https://api.slack.com/methods/conversations.list/test.
  2. In the Arguments section, paste the token in the Or, provide your own token field.
  3. Click Test Method.
  4. 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

  1. Open your Slack app and select the channel to post messages.
  2. Click the gear icon in the top right corner of the channel.
  3. Click Add an App.
  4. Type "Next Matter" in the search bar.
  5. Click Add.

You should see a message in the channel that the bot has been added.

Configure the notification step in a process

  1. In your Next Matter portal, click Workflows, and then click the workflow you want to send messages to Slack.
  2. Click Edit workflow.
  3. Click +Add step and select Integration > Custom integration.
  4. Click Settings to configure the step.
  5. 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
    }
    
  6. 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.

  1. Click +Add step and select Integration > Custom integration.
  2. Click Settings to configure the step.
  3. 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
  4. Create a variable for the user ID with the value of $.user.id.
  5. Save your changes.
  6. Now create a step to send the message. Again, click +Add step and select Integration > Custom integration.
  7. Click Settings to configure the step.
  8. 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.
    {
     "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
    }
    
    9.Save your changes.

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.

  1. Click +Add step and select Integration > Custom integration.

  2. Click Settings to configure the step.

  3. 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
      }
      
  4. Create a variable for the channel ID with the value of $.channel.id.

  5. Save your changes.

  6. To invite users to your channel, click +Add step and select Integration > Custom integration.

  7. Click Settings to configure the step.

  8. 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
      }
      
  9. Create a variable for the channel ID with the value of $.channel.id.

  10. 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:
    1. Open any web browser and log in to your Slack account.
    2. Go to your workspace main page and check the URL in the search bar at the top.
    3. 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

  1. Click +Add step and select Integration > Custom integration.
  2. Click Settings to configure the step.
  3. 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"
      }
      
  4. Create a variable for the Slack reminder ID with the value of $reminder.id.
  5. Save your changes.

Stop the reminder

  1. Click +Add step and select Integration > Custom integration.
  2. Click Settings to configure the step.
  3. 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
      }
      
  4. Create a variable for the Slack reminder ID with the value of $reminder.id.
  5. Save your changes.