Skip to main content
Version: 1.4.x

Triggering Workflow

Once you've published the workflow using your Engagespot Console, it can be trigger using the send notification API itself. You just need to specify the workflow identifier (which you can see on your dashboard).

const { EngagespotClient } = require('@engagespot/node');
const client = EngagespotClient({
apiKey: 'YOUR_ENGAGESPOT_API_KEY',
apiSecret: 'YOUR_ENGAGESPOT_API_SECRET',
});

client.send({
notification: {
workflow: {
identifier: 'workflowIdentifier',
cancellationKey: 'yourUniqueCancellationKey',
},
},
sendTo: {
recipients: ['your-users-unique-identifier'],
},
});

Inline identification of users

It is possible to create the users inline during a workflow trigger. Thus you can avoid creating the user beforehand. Read guide

Scheduling a workflow

You can schedule a workflow to be sent at a later time using the sendAt field. Just make sure that the sendAt field is a valid ISO 8601 date string.

const client = EngagespotClient({ apiKey, apiSecret, dataRegion: 'eu' });

const result = client.send({
notification: {
workflow: {
identifier: 'workflow_identifier',
},
},
sendTo: {
recipients: ['user-id'],
},
sendAt: new Date().toISOString(),
});