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 storechannel data
on yourusers
orobjects
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/orobjects
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.
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.
- Configure your Slack app in the Slack app dashboard.
- Create a Knock channel for your Slack app.
- Use SlackKit components to authorize your bot and give users a Slack channel selector.
- Build your Slack notification templates in a Knock workflow.
- Trigger that workflow with a recipient (
user
orobject
) that has channel data.
In the guides that follow you'll find details on how to accomplish all of the steps above.