Slack
Learn about how to use Slack provider for chat notifications
When using Slack you will have to save the integration credentials in the subscriber entity.
This guide will walk you through the steps needed to obtain the webhookUrl
that Novu requires to send chat messages to your customers.
We will provide the basic flow that the user needs to perform, to successfully send notifications via the Slack integration.
Creating application
This step is optional, if you already have a Slack application you can reuse it.
- Go to Slack’s developer dashboard https://api.slack.com/apps.
- Create a new application.
Integrating Novu with Slack
Manually managed
To use the manually managed option, you need to generate a webhookUrl
and plug it into your backend.
- Goto ‘Incoming Webhooks’ in your Slack app settings and turn it on.
Turn on 'Incoming Webhooks' in your Slack app
- Click on the ‘Add New Webhook to Workspace’:
Click the 'Add New Webhook to Workspace' button
- Now, go ahead and select the channel in which you want to send notifications and click ‘allow’.
Select the channel
- Then, copy the ‘webhookUrl’ from Slack.
Copy the webhookUrl from Slack
- Now, you need to save the
webhookUrl
on the relevant subscriber entity in Novu. Here’s an example to do the same using our Node SDK:
Writing Slack content (Blocks API)
Novu Framework supports using blocks as part of the delivered messages using the provider overrides of the chat
channel:
You can use the Blocks Playground from Slack to learn more about the diffrent blocks available.
Update credential webhookUrl
Checkout the API reference for more details.
subscriberId
is a custom identifier used when identifying your users within the Novu platform.providerId
is a unique provider identifier. We recommend using our ChatProviderIdEnum.Slack if you’re using Node, else string of Slack to specify the provider.- The third parameter is the credentials object. In this case, we use the
webhookUrl
property to specify the webhook URL generated in the previous step.
- You are all set up and ready to send your first chat message via our @novu/node package or directly using the REST API.
Configuring Slack application
- Go to OAuth & Permissions on Slack’s Developer Dashboard and add your REDIRECT_URL in Redirect URLs.
- If you use a manual Management solution, add the API endpoint you created in Step 1.
- Go to Incoming Webhooks from the left menu and Activate Incoming Webhooks.
- Go to Manage Distribution and at the bottom of the page, tick Remove Hard Coded Information and Activate Public Distribution.
Enabling HMAC Encryption
To enable Hash-Based Message Authentication Codes, you need to do the following steps:
-
Visit the integration store page and enable HMAC encryption under your chat provider.
-
The next step would be to generate an HMAC encrypted subscriberId on your backend:
-
Add the newly created hash HMAC to the Sharable URL as a query.
This concludes the Slack provider guide.