electron
electron
NNovu
Created by electron on 9/19/2024 in #💬│support
Novu inbuilt SMS provider does not seem to work
No description
7 replies
NNovu
Created by electron on 9/18/2024 in #💬│support
Workflow: Skip Email for Subscribers Without Email and Try SMS Flow
I am trying to create a workflow where if the subscriber does not have an email we skip the email and try sms flow. But i dont think I am doing it correctly. Additionally I cannot find any resource on this topic. sample code:
export const rewardSummaryWorkflow = workflow(
'reward-summary',
async ({ step, payload, subscriber }) => {
await step.email(
'send-email',
async controls => {
return {
subject: `Your Summary`,
body: renderEmail(controls, payload),
};
},
{
controlSchema,
skip: () => !subscriber.email || subscriber.email.length === 0,
},
);
await step.sms('sms', async () => {
return {
body: `Yo!`,
};
});
},
{
payloadSchema,
},
);
export const rewardSummaryWorkflow = workflow(
'reward-summary',
async ({ step, payload, subscriber }) => {
await step.email(
'send-email',
async controls => {
return {
subject: `Your Summary`,
body: renderEmail(controls, payload),
};
},
{
controlSchema,
skip: () => !subscriber.email || subscriber.email.length === 0,
},
);
await step.sms('sms', async () => {
return {
body: `Yo!`,
};
});
},
{
payloadSchema,
},
);
15 replies