N
Novu10mo ago
JD (SYT )

Response from novu.trigger

Let us say the preferences were saved to send email and not sms. When we call novu.trigger(..) can we know in the response which were sent?
10 Replies
Mei
Mei10mo ago
Not from the response of the trigger call itself, but you can subsequently query novu.messages.list({ transactionIds: [the_id] }) with the transactionId given back in the response to the trigger
Novu_Bot
Novu_Bot10mo ago
@Mei, you just advanced to level 2!
Mei
Mei10mo ago
Just know that you would will have to handle concurrency stuff because the messages sent in response to a trigger happen in a queue that Novu has to get to, not immediately upon your trigger call, and if you’re using Digests then the messages aren’t sent until the digest window elapses.
JD (SYT )
JD (SYT )OP10mo ago
Thanks. So when I call the trigger I get a response which has a transactionID in it which I can later use to call messages.list. However I cannot know when to call messages.list as I do not know when novu internal workers have actually sent the sms or email?
Mei
Mei10mo ago
You have it correct
JD (SYT )
JD (SYT )OP10mo ago
So maybe I should assume that novu sent stuff but to know what it sent I should query the preferences before triggering so at least I know what it was meant to send.
Mei
Mei10mo ago
It’s possible to monitor the progress of the trigger’s jobs by querying the execution details, but I don’t know of any way to have Novu notify you when it’s finished sending messages for a trigger Other than having the last step in the workflow be to send a webhook to your server 😂
JD (SYT )
JD (SYT )OP10mo ago
Re: webhook - that sounds like what I need - thanks 🙂
Mei
Mei10mo ago
Good luck!
JD (SYT )
JD (SYT )OP10mo ago
Thank you for your help
Want results from more Discord servers?
Add your server