Skip to main content
Version: 1.4.x

Cancelling Workflows

Cancelling workflows allows you to stop a running workflow to prevents it from continuing to send messages to recipients. This is crucial in cases like reminder workflows, where notifications should cease once a user has taken the desired action.

Only workflows with steps that can pause the run can be stopped mid-execution. Otherwise, Engagespot will immediately send out notifications. The steps that can pause a workflow include:

  1. Delay: This function pauses the workflow for a set duration before moving to the next step.

  2. Batch:Helps you to combine multiple notifications that are triggered in a short interval of time into one.

  3. Wait for Input: This function pauses the workflow until specific input is received, facilitating interactive workflows that respond to user actions or system events.

  4. Fetch: This step makes API requests to retrieve additional data necessary for the workflow, enhancing the workflow's ability to dynamically adapt based on real-time information.

Canceling a triggered workflow

info

To cancel a workflow, you must first include a cancellationKey in the workflow trigger request. Engagespot uses this key to uniquely identify the specific workflow instance that should be canceled.

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

client.workflows.cancelRun('yourWorkflowIdentifier', {
cancellationKey: 'YourUniqueCancellationKey',
cancelFor: {
recipients: ['user_one_identifier'],
},
});