N
Novu•2mo ago
Zwonkoh

Connect Discord Bot with Novu

Hey i want to integrate my novu notifications with my Discord Bot which is created with Commandkit. I added the Push Webhook Provider in novu for that. I had the following error which is shown in the screenshot. i assume the problem is that i didnt set the credentials right now. on the documentation there is a example where i should set my credentials but on as it seems the novu/node package is marked as deprecated. https://docs.novu.co/platform/integrations/chat/discord?utm_campaign=in-app So could you tell me how do i configure it with the novu/api package.
Discord | Novu Documentation
Learn about how to use Discord provider for chat notifications
No description
7 Replies
Pawan Jain
Pawan Jain•2mo ago
Hi 👋

Just updated the discord code snippet for @novu/api

It will be updated in a few minutes. Please refresh the page
Pawan Jain
Pawan Jain•2mo ago
@Zwonkoh checkout the doc now https://docs.novu.co/platform/integrations/chat/discord
import { Novu } from '@novu/api';
import { ChatOrPushProviderEnum } from "@novu/api/models/components";

const novu = new Novu({
secretKey: "<NOVU_SECRET_KEY>",
// Use serverURL for EU region
// serverURL: "https://eu.api.novu.co",
});

await novu.subscribers.credentials.update(
{
providerId: ChatOrPushProviderEnum.Discord,
credentials: {
webhookUrl: "<WEBHOOK_URL>",
},
integrationIdentifier: "discord-MnGLxp8uy",
},
"subscriberId"
);
import { Novu } from '@novu/api';
import { ChatOrPushProviderEnum } from "@novu/api/models/components";

const novu = new Novu({
secretKey: "<NOVU_SECRET_KEY>",
// Use serverURL for EU region
// serverURL: "https://eu.api.novu.co",
});

await novu.subscribers.credentials.update(
{
providerId: ChatOrPushProviderEnum.Discord,
credentials: {
webhookUrl: "<WEBHOOK_URL>",
},
integrationIdentifier: "discord-MnGLxp8uy",
},
"subscriberId"
);
Discord | Novu Documentation
Learn about how to use Discord provider for chat notifications
Zwonkoh
ZwonkohOP•2mo ago
Hey, when i import the ChatOrPushProviderEnum i get the error "Module '"@novu/api/models/components"' has no exported member 'ChatOrPushProviderEnum'.ts(2305)"
Pawan Jain
Pawan Jain•2mo ago
can you please share @novu/api version?
Zwonkoh
ZwonkohOP•2mo ago
"@novu/api": "^0.5.0",
Pawan Jain
Pawan Jain•2mo ago
please use laest version 1.6.0 https://www.npmjs.com/package/@novu/api
npm
@novu/api
The <Inbox /> infrastructure for modern products. Latest version: 1.6.0, last published: 9 days ago. Start using @novu/api in your project by running npm i @novu/api. There are no other projects in the npm registry using @novu/api.
Zwonkoh
ZwonkohOP•2mo ago
thank you that worked

Did you find this page helpful?