Skip to content

Commit

Permalink
Method to send notification to users
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Jun 7, 2024
1 parent acd0c68 commit 063de44
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/novu/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Novu } from "@novu/node";

export default async function sendNotification(subscriberId: string) {
try {
const novu = new Novu(process.env.NOVU_API_KEY || "");

await novu.subscribers.identify(subscriberId, {});

novu.trigger("pft", {
to: {
subscriberId,
},
actor: "https://media.tenor.com/iwXHwlY31ecAAAAM/yuji-itadori-suku.gif",
payload: {},
});

return subscriberId;
} catch (error) {
console.error("Error sending notification :", error);
throw error;
}
}

0 comments on commit 063de44

Please sign in to comment.