Skip to main content
Version: 1.5.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',
dataRegion: 'us', // us or eu based on your workspace.
});

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

You can pass data payload along with workflow trigger to replace your template variables.

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(),
});