expiry for notifications

Is there a way to expire the notifications? Let's say I run a weekly worker to send a notification, I want to remove the notification after 2 days, is that possible?
17 Replies
Ask Inkeep
Ask Inkeep3mo ago
Hi @ManwinderSingh, I'm an AI assistant for Novu. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions. Please tag @Ask Inkeep with any follow-up questions. ----------------------------- While I generate an answer, here are some sources that might be helpful: * How to send PUSH notifications to iOS devices with FCM using Novu * Workflows * Data Migrations * Digest Engine -----------------------------
Ask Inkeep
Ask Inkeep3mo ago
Answer Currently, Novu notifications have a default expiration time of 12 months, and there isn't a built-in feature to customize this expiration time to a shorter period like 2 days. This limitation means that automatically expiring notifications after a specific short duration, such as 2 days, isn't directly supported within Novu's existing features as of the latest information available (1) . For use cases requiring notification expiration sooner than the default, you might need to implement a custom solution outside of Novu to manage and delete notifications based on your specific requirements.
Ask Inkeep
Ask Inkeep3mo ago
Got it. Tagging @Support for additional help.
ManwinderSingh
ManwinderSingh3mo ago
@Pawan Jain @Emil Please help here
Novu_Bot
Novu_Bot3mo ago
@ManwinderSingh, you just advanced to level 2!
Pawan Jain
Pawan Jain3mo ago
@ManwinderSingh Sorry for delayed response. Are you looking to permanently delete the in-app message for user after 2 days?
ManwinderSingh
ManwinderSingh3mo ago
Yes
Pawan Jain
Pawan Jain3mo ago
It can be done using delete message api https://docs.novu.co/api-reference/messages/delete-message
ManwinderSingh
ManwinderSingh3mo ago
Sorry for some silly questions, but where can I find the message id ? For this I will have to create a daily-worker and store the IDs which I need to expire explicitly right?
Pawan Jain
Pawan Jain3mo ago
Yes, you will need to store messageId for that
ManwinderSingh
ManwinderSingh3mo ago
Where will I get the Message ID? while triggering it ?
Pawan Jain
Pawan Jain3mo ago
It will require another api call You can use this api instead
Pawan Jain
Pawan Jain3mo ago
It will delete all meessages related to transactionId transactionId will be returned when you trigger the workflow
ManwinderSingh
ManwinderSingh2mo ago
Alright okay thanks. It would be helpful @Pawan Jain Just to confirm In case I trigger a workflow for topic, I will get single transactionId for that right? and when I trigger this delete api call, that should ideally delete the notifications ?
Pawan Jain
Pawan Jain2mo ago
using above api all messages generated due to trigger to of that topic will be deleted
ManwinderSingh
ManwinderSingh2mo ago
Wow! that sounds good