Is there a way to get message id when trigger the workflow from the backend?
This is so the backend can save a history of messages sent, and request delete if needed. The https://docs.novu.co/workflows/messages#delete-a-message uses messageId, but the responsed from novu.trigger returns transcationId. Alternatively is there an API to delete message by transcationId?
7 Replies
Hi @Yang, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question.
@Yang, you just advanced to level 1!
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Messages
* Workflows
* Delete messages by transactionId
* Send Your First Notification
-----------------------------
Answer
Yes, there is an API available in Novu that allows you to delete messages by their
transactionId
. This is particularly useful when you want to handle message deletion based on the transaction ID, which is returned when a workflow is triggered. The API endpoint for deleting messages by transactionId
is documented and can be used to delete all messages associated with a specific transactionId
(1) .
Here is an example of how you can use this API:
This method ensures that you can programmatically manage the deletion of messages sent as part of a transaction, even if the direct message IDs are not returned when the workflow is initially triggered.Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
@Yang
Checkout this api to delete messages using transactionId
https://docs.novu.co/api-reference/messages/delete-message-by-transactionid
Yes that works thanks