Fix Novu API import error

This commit is contained in:
gpt-engineer-app[bot]
2025-10-12 15:43:19 +00:00
parent 1333a5e8c8
commit f294020d0b
6 changed files with 21 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
import { Novu } from "npm:@novu/api@0.0.7";
import { Novu } from "npm:@novu/api@1.6.0";
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
@@ -18,17 +18,19 @@ serve(async (req) => {
throw new Error('NOVU_API_KEY is not configured');
}
const novu = new Novu({
apiKey: novuApiKey,
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
const novu = new Novu({
secretKey: novuApiKey
});
const { workflowId, subscriberId, payload, overrides } = await req.json();
console.log('Triggering notification:', { workflowId, subscriberId });
const result = await novu.events.trigger(workflowId, {
to: subscriberId,
const result = await novu.trigger({
to: {
subscriberId,
},
workflowId,
payload,
overrides,
});