Prerequisites

To get started, you’ll need:

What you’ll do:

  1. Add the Slack integration in Courier
  2. Create and configure a Slack app
  3. Design a notification template
  4. Send a test message

Step-by-Step: Send Your First Slack Message

1

Add Slack Integration in Courier

Once logged in to Courier, go to the Integrations page and select Slack. Click “Install” to add the integration.

Courier Slack Integration

2

Create and Configure a Slack App

  1. Go to the Slack Apps page and click “Create an App”.
  2. Choose “From scratch”, give your app a name, and select your development workspace.
  3. Under “OAuth & Permissions”, add these Bot Token Scopes: chat:write, im:write, users:read, users:read.email.
  4. Click “Install App to Workspace” and authorize.
  5. Copy the Bot User OAuth Access Token (starts with xoxb-).

Slack OAuth Scopes

3

Design a Slack Notification Template

Go to the Courier Assets page and click + New > Message Template. Select Slack from your list of integrations. In the sidebar, click the newly added Slack block to open the Slack template editor. Add your desired message content to the template.

4

Send a Test Message

Click Preview, then select Create Test Event. Enter your bot token in the Access Token field. Click Send—your message should appear in Slack!


Message Targeting Reference

Courier supports sending Slack messages to users and channels in several ways. Here are the most common targeting methods:

{
  "message": {
    "to": {
      "slack": {
        "access_token": "xoxb-xxxxx",
        "email": "user@example.com"
      }
    }
  }
}

Order of Precedence: If you provide more than one of channel, user_id, or email, Courier will use them in this order: channel > user_id > email.


Advanced Features & Customization

Courier supports a variety of advanced Slack features for more control and interactivity. Here are the most useful options:

Provider Overrides

You can override the payload sent to Slack’s chat.postMessage using the providers.slack.override.body field. This is useful for advanced formatting, interactivity, and threading.

{
  "providers": {
    "slack": {
      "override": {
        "body": {
          "unfurl_links": true
        }
      }
    }
  }
}

Slack Blocks (Block Kit)

Send rich, interactive layouts using Slack blocks:

{
  "providers": {
    "slack": {
      "override": {
        "body": {
          "blocks": [
            { "type": "header", "text": { "type": "plain_text", "text": "Welcome!" } },
            { "type": "section", "text": { "type": "mrkdwn", "text": "This is a *section* block." } }
          ],
          "text": "Fallback plain text."
        }
      }
    }
  }
}

Design and preview your blocks visually with the Slack Block Kit Builder.

Replying in a Thread

To reply to a thread, set the thread_ts value:

{
  "providers": {
    "slack": {
      "override": {
        "body": {
          "thread_ts": "1234567890.123456"
        }
      }
    }
  }
}

Mentioning Users

Mention a user in your message using <@USER_ID> syntax in your template:

Hello <@UEFNTF6QL>, you have a new notification!

You can also use variables for dynamic mentions.

Slash Command Responses

If responding to a Slash Command, use the response_url as an incoming webhook:

{
  "to": {
    "slack": {
      "incoming_webhook": {
        "url": "https://hooks.slack.com/commands/1234/5678"
      }
    }
  }
}

Set override.slack.body.response_type to in_channel or ephemeral as needed.

Incoming Webhooks

You can send messages to a channel using a Slack Incoming Webhook:

{
  "to": {
    "slack": {
      "incoming_webhook": {
        "url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
      }
    }
  }
}

Updating Notifications

To update a previously sent Slack message, set a “replacement key” (usually ts) in your notification template’s Slack channel settings. Courier will use this key to update the message instead of posting a new one.


Troubleshooting & Resources

Common Issues & Solutions

  • Missing or incorrect Slack scopes:

    • Double-check your app has all required scopes (chat:write, im:write, users:read, users:read.email, and chat:write.public for channels).
    • Reinstall your Slack app after updating scopes.
  • Bot not invited to channel:

    • Make sure your Slack app/bot is a member of the channel you want to message.
  • Invalid or missing tokens:

    • Ensure you are using the correct Bot User OAuth Access Token (starts with xoxb-).
    • Never use a user token or an expired token.
  • Permission errors or message not delivered:

  • User or channel not found:

    • Double-check the email, user_id, or channel ID. For channels, copy the ID from the Slack URL.

If you’re still stuck, reach out to Courier support or visit the Slack API community forums for more help.