Skip to main content
You can use $.flow.suspend and $.flow.rerun to pause a workflow and resume it later. This is useful when you want to:
  • Pause a workflow until someone manually approves it
  • Poll an external API until some job completes, and proceed with the workflow when it’s done
  • Trigger an external API to start a job, pause the workflow, and resume it when the external API sends an HTTP callback
We’ll cover all of these examples below.

$.flow.suspend

Use $.flow.suspend when you want to pause a workflow and proceed with the remaining steps only when manually approved or cancelled. For example, you can suspend a workflow and send yourself a link to manually resume or cancel the rest of the workflow:
export default defineComponent({
  async run({ $ }) {
    const { resume_url, cancel_url } = $.flow.suspend();
    $.send.email({
      subject: "Please approve this important workflow",
      text: `Click here to approve the workflow: ${resume_url}, and cancel here: ${cancel_url}`,
    });
    // Pipedream suspends your workflow at the end of the step
  },
});
You’ll receive an email like this: