abellaismail
abellaismail
NNovu
Created by abellaismail on 7/27/2024 in #💬│support
how to trigger a defined workflow
Hi I am trying to trigger this workflow but I keep getting an error telling me that the workflow does'nt exist
const myWorkflow = workflow(
"new-signup",
async ({ step, payload }) => {
await step.email("send-email", async () => {
console.log("done");
return {
subject: `Welcome to Acme.`,
body: "We look forward to helping you achieve mission.",
};
});
},
{
// payloadSchema: z.object({}),
},
);

console.log(
await myWorkflow
.trigger({
payload: {},
})
.catch((e) => {
console.log(e);
}),
);
const myWorkflow = workflow(
"new-signup",
async ({ step, payload }) => {
await step.email("send-email", async () => {
console.log("done");
return {
subject: `Welcome to Acme.`,
body: "We look forward to helping you achieve mission.",
};
});
},
{
// payloadSchema: z.object({}),
},
);

console.log(
await myWorkflow
.trigger({
payload: {},
})
.catch((e) => {
console.log(e);
}),
);
I get a 422 error. message: workflow not found env:
NOVU_API_KEY=
NOVU_SECRET_KEY=
NEXT_PUBLIC_NOVU_UID=
NEXT_PUBLIC_NOVU_BACKEND_URL=https://api.novu.co
NEXT_PUBLIC_NOVU_SOCKET_URL=https://ws.novu.co
NOVU_API_KEY=
NOVU_SECRET_KEY=
NEXT_PUBLIC_NOVU_UID=
NEXT_PUBLIC_NOVU_BACKEND_URL=https://api.novu.co
NEXT_PUBLIC_NOVU_SOCKET_URL=https://ws.novu.co
3 replies