N
Novu7mo ago
ebm

Best way to cancel a currently in-progress workflow?

Probably easier to describe what I am trying to do. If a user signs up for newsletters, this triggers a workflow with n emails. The emails are spaced out by days. If the user signs up for a subscription while this workflow is "in progress" I want to cancel this workflow so I can start them on a different workflow. I know that when I trigger the workflow originally I get a transaction id, is there a way to get the current "in progress" transactions for a subscriber so I can cancel the remaining unsent emails? Or do I need to store the transaction Id originally and keep track of what is active/not?
7 Replies
Pawan Jain
Pawan Jain7mo ago
Hi @ebm Could you please explain these statements with more info? 1. The emails are spaced out by days 2. I want to cancel this workflow so I can start them on a different workflow.
ebm
ebm7mo ago
here's part of the workflow in novu ui
ebm
ebm7mo ago
No description
ebm
ebm7mo ago
so the workflow could be "active" or "in progress" for many days let's say they get 2 emails, then decide they want to subscribe, they don't need the remaining emails in this workflow, so I want to cancel it (it's really irrelevant that I will start a new workflow) I know there are API calls to cancel a workflow if you have a transaction Id, but my real question is, can I get the "active" workflows for a given subscriberId
Novu_Bot
Novu_Bot7mo ago
@ebm, you just advanced to level 2!
Pawan Jain
Pawan Jain7mo ago
Hi @ebm Thanks for sharing the usecase. Currently get notifications api does not have an option to fetch using worflow execution status