sultansaeed.
sultansaeed.
NNovu
Created by sultansaeed. on 12/24/2024 in #💬│support
Subject Undefined from a new workflow
Yes @Pawan Jain
8 replies
NNovu
Created by sultansaeed. on 12/24/2024 in #💬│support
Subject Undefined from a new workflow
This is how I created my workflow { "subscriberId": "6760297481105a45d22ec004", "workflowIdentifier": "salman-test-workflow", "payload": { "fullName": "Sharjeel Qadeer" } } API : app.post('/send-notification', async (req, res) => { const { subscriberId, workflowIdentifier, payload } = req.body; // Correct field names console.log('Request Body:', req.body); // Validate input if (!subscriberId !workflowIdentifier !payload) { return res.status(400).json({ error: 'Missing required fields: subscriberId, workflowIdentifier, or payload.', }); } try { // Trigger the workflow await novu.trigger(workflowIdentifier, { to: { subscriberId, }, payload, }); console.log("Notification sent successfully!"); res.status(200).json({ message: 'Notification sent successfully!' }); } catch (error) { console.error('Error sending notification:', error.response?.data error.message); res.status(500).json({ error: 'Failed to send notification.', details: error.response?.data error.message, }); } });
8 replies
NNovu
Created by sultansaeed. on 12/24/2024 in #💬│support
Subject Undefined from a new workflow
@Pawan Jain yes bro
8 replies