Slack integration examples
In this guide we'll cover a number of use cases you can support with Knock's Slack integration.
- Sending channel notifications to your customer’s Slack workspace
- Sending direct messages in your customer’s Slack workspace
- Sending notifications to a channel in your own internal Slack workspace
incoming-webhook
scope that we describe here. In the examples below we use incoming-webhook
to keep things simple.Sending notifications to a channel in your customer’s Slack workspace
When you are notifying a channel in your customer’s Slack workspace (and not an individual user) it’s usually because that channel maps to the notification stream of a specific resource in your product.
For these types of resource-to-channel integrations, you’ll use Knock objects to store the incoming_webhook.url
received from Slack. Here’s an example from the Linear example we mentioned above.
When you want to notify the Slack channel about something that took place in that object, you send the object as a recipient in your relevant workflow trigger.
To learn more about how to use objects to power Slack channel notifications, see the Slack example in our object documentation.
Sending direct messages to a user in your customer’s Slack workspace
If you want to notify a user in Slack via direct message instead of through a channel, you can still accomplish this through a simple Slack app with the incoming-webhook
scope. (This is possible because during the OAuth flow for an app with the incoming-webhook
scope, the installing user can select their own Direct Message channel for the integration.)
Just surface your Slack OAuth flow to users in their personal notification settings and store the webhook URL received from the OAuth process on the relevant user
in Knock.
You can learn more users and channel data in our docs on how to set channel data.
Sending notifications to a channel in your own Slack workspace
There are certain cases where you want to notify a channel in your own internal Slack workspace when something happens in your product. In these scenarios, use your best judgement as to whether the Slack connection data (the incoming_webhook.url
) should live on a user or an object in Knock.
An example: at Knock we notify a support channel when a user in our dashboard submits a feedback ticket. Since these support tickets all come into the same Slack channel regardless of which account they come from in Knock, we store our Slack connection data on a support bot user
within Knock.