How Knock sends Slack notifications

In this guide we'll provide an overview of how Knock sends notifications to Slack, the key concepts involved, and the steps you'll take to configure your Slack integration in Knock.

Key concepts

Here's a list of terms and concepts we'll be referencing throughout our Slack guides.

  • Slack app. The Slack app you configure within the Slack API platform. This is sometimes referred to as a Slack bot but we'll be using the term "Slack app" throughout this documentation. This is what your customers install into their own Slack workspace during the Slack OAuth flow you start from within your product.
  • Knock channel. The channel you configure within the Knock dashboard. You'll use the id of this channel when you store channel data on your users or objects in Knock.
  • Slack channel. A channel in your customer's Slack workspace that you want to notify. "Channel" is an overloaded term between Knock and Slack, so we'll always refer to channels that live within Slack as "Slack channels". Note that this can refer to a public channel, a private channel, or even a user DM channel.
  • Tenant. Where your Slack access token will be stored, and what you'll use when triggering workflows with a Slack channel step to give your app access to post on your behalf.
  • Channel data. The connection data received from the Slack OAuth handshake, either an incoming webhook URL or an access token. Stored on users and/or objects in Knock so we know where to send a Slack notification for a given recipient.

How Knock powers Slack notifications

As with any other channel type in Knock, you'll need to configure your Slack app as a Knock channel before you can use it in your notification workflows. Once you've created a Knock channel for your Slack app, you're ready to start adding it to your notification workflows.

🌠
Supporting multiple Slack bots. In some cases you might have multiple Slack apps you want to power with Knock, such as an app that your customers install in their own Slack workspaces and an internal app you use for internal team-facing notifications (e.g. new signup alerts.)

To support this you'd just create two separate Knock channels, one for each Slack app. Then when you're adding a Slack channel step to a workflow you'll select which Slack app you'd like Knock to notify.

Once you add a Slack channel step to a workflow, it works the same as any other channel step. The workflow engine will look for Slack channel data on the workflow run's recipient (note: this recipient can be either a user or an object) and send the notification generated by your template to that Slack channel.

The steps to configure your Slack integration

To recap, here are the steps you'll take to build your customer-facing Slack integration.

  1. Configure your Slack app in the Slack app dashboard.
  2. Create a Knock channel for your Slack app.
  3. Use SlackKit components to authorize your bot and give users a Slack channel selector.
  4. Build your Slack notification templates in a Knock workflow.
  5. Trigger that workflow with a recipient (user or object) that has channel data.

In the guides that follow you'll find details on how to accomplish all of the steps above.