Chat
Discord
Learn about how to use Discord provider for chat notifications
When using Discord, you will have to store the integration credentials within the subscriber entity. Discord supports two ways to do this:
- Using the Discord Webhook integration.
- Using the Discord Bot integration.
Right now, Novu only supports the Discord Webhook integration. This approach has been because the easiest way to set it up is when you have a predefined destination for where the notifications should be sent. It’s particularly useful for notifying a specific channel about updates.
Quickstart:
To get started with using Novu’s Discord Webhook integration, you need a ‘webhook token’. Here’s how you can generate the same for testing purposes:
- Go to the channel you want to add the webhook to (you need to be an admin of the discord server).
- Right-click the channel and select “Edit Channel”.
- Integrations -> Webhooks -> New Webhook
- Copy the webhook URL.
- After obtaining the webhook URL in the previous step, you need to store it within the subscriber entity. Doing this ensures that Novu knows where (in which discord channel) to send the notification to. Here’s how to do it:
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 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 in the channel you chose on your discord server.