N
Novu6mo ago
Yang

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?
Novu
Messages - Novu
Learn about messages in Novu
7 Replies
Ask Inkeep
Ask Inkeep6mo ago
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.
Novu_Bot
Novu_Bot6mo ago
@Yang, you just advanced to level 1!
Ask Inkeep
Ask Inkeep6mo ago
----------------------------- While I generate an answer, here are some sources that might be helpful: * Messages * Workflows * Delete messages by transactionId * Send Your First Notification -----------------------------
Ask Inkeep
Ask Inkeep6mo ago
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:
curl --request DELETE \
--url 'https://api.novu.co/v1/messages/transaction/{transactionId}' \
--header 'Authorization: ApiKey <NOVU_API_KEY>'
curl --request DELETE \
--url 'https://api.novu.co/v1/messages/transaction/{transactionId}' \
--header 'Authorization: ApiKey <NOVU_API_KEY>'
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.
Ask Inkeep
Ask Inkeep6mo ago
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
Pawan Jain
Pawan Jain6mo ago
@Yang Checkout this api to delete messages using transactionId https://docs.novu.co/api-reference/messages/delete-message-by-transactionid
Yang
Yang6mo ago
Yes that works thanks
Want results from more Discord servers?
Add your server