N
Novu8mo ago
bborn

How are workflow updates propagated?

Here's my situation: my workflow previously had a first email, then a one week delay, then a second email. A few subscribers had that workflow triggered last week. Later last week, I updated the workflow and published the changes, removing the delay and the second email. However, some subscribers still seem to be getting the second email. My question: is the entire workflow queued at the time of triggering, or should changes to the workflow be reflected in previously-triggred runs? Thanks in advance ...
23 Replies
bborn
bborn8mo ago
Ping. Anybody? Would love some help with this one. I believe there are a bunch of emails queued to send that reference a previous version of the workflow (with an email step that I have since deleted)
Gali Baum
Gali Baum8mo ago
Yes, when you trigger, the event will execute what steps /content you had at the time of the trigger @bborn You can use the cancel api endpoint Are you using v0.21.0?
Gali Baum
Gali Baum8mo ago
Novu
Cancel triggered event - Novu
Using a previously generated transactionId during the event trigger, will cancel any active or pending workflows. This is useful to cancel active digests, delays etc...
bborn
bborn8mo ago
@Gali Baum where do I get the transactionId? (we weren't saving it when triggering the workflow)
Gali Baum
Gali Baum8mo ago
You can see it at the activity feed
bborn
bborn8mo ago
what if I want to cancel all pending emails? the workflow had a testing email published in it
Gali Baum
Gali Baum8mo ago
What do you mean?
bborn
bborn8mo ago
ok, so we had a workflow published that included an email, a delay, and then another email the second email was junk - just a test email we don't want it to send
Gali Baum
Gali Baum8mo ago
Yes, ok. How did you do the trigger in regards to the subscribers? Did you do for all of them at once ? Or multiple triggers?
bborn
bborn8mo ago
one trigger per subscriber
Novu_Bot
Novu_Bot8mo ago
@bborn, you just advanced to level 1!
Gali Baum
Gali Baum8mo ago
So you’d have to do the cancel for each one 😞 If they had the same transaction id, it would have been 1 api call for all subscribers
bborn
bborn8mo ago
ok, so where can I list all the transactionIds programatically? Is there an API endpoint? Or must I go through the activity feed by hand? or is there some way to just cancel ALL pending notifications what if I just delete the workflow? will they still be sent?
Gali Baum
Gali Baum8mo ago
Yes, a trigger is an event. Changes to the workflow will not apply, as you already executed it How many of those do you have?
bborn
bborn8mo ago
i don't know ... probably hundreds it seems very weird to me that once an event is triggered, changes to/deletion of the workflow have no impact on the notification. Seems clear to me that you might want to edit a worflow notification step after the fact, and have it apply to any notifications that are still pending like, you might have thousands of email notifications pending as part of a delayed workflow, and you have a critical typo to fix and there's no way to do it? also, you can't copy the transactionId from the activity feed - the element is not selectable if you click the transactionId it opens the modal with the execution details which doesn't include the transactionId?
Gali Baum
Gali Baum8mo ago
You could also look at it the other way around. That once triggered it makes sense that you know that that is what you will get at that point of time. That is also why you have 2 envs... In regards to getting /canceling all the pending transactionIds or even getting historical transaction ids, I find it a very valid usecase. I will tag our PM tomorrow to consider
bborn
bborn8mo ago
Respectfully: totally disagree. It's much more likely that you have a typo or other error that is critical to fix, and you just want to update the workflow to be correct. but lacking that, then yes, a way to bulk delete/pause/cancel (and maybe even edit) those transactions seems pretty important because right now, I have X number of transactions out there in the queue which are incorrect, but no way to stop them, aside from disabling the entire email integration (which is what I did). I can't turn the integration back on, because if I do all those mistaken emails are going to get sent
Pawan Jain
Pawan Jain8mo ago
Hi @bborn Sorry for the inconvenience Until we add option to stop/cancel pending delayed/digested events. Best way to stop these events (notifications) is this:- Use this api to fetch all triggered events:- https://docs.novu.co/api-reference/notification/get-notifications This api will return an array of events. Each item will have transactionId field Then you can cancel individual event using this API https://docs.novu.co/api-reference/notification/get-notifications
bborn
bborn8mo ago
i tried this before, the cancel endpoint returns false so I don't know if the transaction was actually canceled or not: https://d.pr/i/ruQGlN
Droplr
Markup 2023-10-31 at 13.08.58.png
Shared with Droplr
Pawan Jain
Pawan Jain8mo ago
if it returned false means that event (notification) is canceled/completed already
bborn
bborn8mo ago
ok, thanks. I wrote a script to cancel all of them. running now. Just again emphasizing my request: I think it's very counterintuitive that once a notification is triggered, there's no way to update it, and editing the workflow itself has no impact on it.
Novu_Bot
Novu_Bot8mo ago
@bborn, you just advanced to level 2!
Linear
Linear8mo ago
Issue DVRL-72 created.
DVRL-72 - workflow once triggered can not be changed.
workflow can be cancelled only using DELETE /events/cancel api
Status
Triage
DevRel