mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 17:51:14 -05:00
feat: Implement Novu topics for moderator notifications
This commit is contained in:
@@ -22,14 +22,21 @@ serve(async (req) => {
|
||||
secretKey: novuApiKey
|
||||
});
|
||||
|
||||
const { workflowId, subscriberId, payload, overrides } = await req.json();
|
||||
const { workflowId, subscriberId, topicKey, payload, overrides } = await req.json();
|
||||
|
||||
console.log('Triggering notification:', { workflowId, subscriberId });
|
||||
// Support both individual subscribers and topics
|
||||
if (!subscriberId && !topicKey) {
|
||||
throw new Error('Either subscriberId or topicKey must be provided');
|
||||
}
|
||||
|
||||
const recipient = subscriberId
|
||||
? { subscriberId }
|
||||
: { topicKey };
|
||||
|
||||
console.log('Triggering notification:', { workflowId, recipient });
|
||||
|
||||
const result = await novu.trigger({
|
||||
to: {
|
||||
subscriberId,
|
||||
},
|
||||
to: recipient,
|
||||
workflowId,
|
||||
payload,
|
||||
overrides,
|
||||
|
||||
Reference in New Issue
Block a user