Can I Programmatically Replay Failed Workflow Using API?

This topic was automatically generated from Slack. You can find the original thread here.

Hi Team, Is there anyway I can programmatically replay failed workflow using API? Could anyone help me with this?

Hey there, no unfortunately, use the Event History to select events (you can go through pages and the selections will still maintain) and replay them in bulk

Thanks . I have a use case where I have to retry failed workflow using cron job by using workflow id. So people involvement will be avoided. Do you have any other recommendation to achieve this goal?

What does each workflow do, can you explain in detail?

  1. The workflow you want to monitor
    a. is it triggered on an HTTP webhook, app event?
    b. when can it fail, in the middle?
    c. do you need to replay from where it failed, from the beginning?
  2. The workflow that run on a cron
    a. will it monitor N workflows?
    b. how often will it run?

I’ll probably ask more questions for further clarification after your response

  1. The workflow you want to monitor
    a. is it triggered on an HTTP webhook, app event? - Webhook
    b. when can it fail, in the middle? - one for steps in the workflow
    c. do you need to replay from where it failed, from the beginning? - From the beginning
  2. The workflow that run on a cron
    a. will it monitor N workflows? - Only one workflow
    b. how often will it run? - Once a day

In that case, you could keep track of the events that haven’t been successful yet, e.g. in a data store. If they don’t succeed, your workflow that runs on a cron can invoke the workflow you are monitoring with the original event

If the execution succedes, delete that event from the data store

FYI, there is a config called auto-retry on errors, which completely removes the necessity of doing this all yourself

Thanks again, . Let me check the document shared