Question with Fetching Unread Messages for Specific Topics in Daily/Weekly Digests
We have implemented a system where "topics" (groups) are utilized to send "events" (messages/notifications) to all "subscribers" (members) of the group. The requirement is to send a digest email to subscribers on a daily or weekly basis, summarizing all unread messages. Additionally, if a subscriber logs in during a digest period, they should be able to mark all messages as read or potentially delete them up until a certain "initial publication date".
How to do this with the API, at the notification endpoint there not info about the "topic".
16 Replies
@gigo1980
here you are sending in-app notification to subscribers?
Hi @Pawan Jain . Not yet. We try to send a summary on a daily base by email. So if anyone is doing anything in the group the members should be notified if they are not online at the moment.
For example 1pm someone is doing something in a group, event trigger (for a topic, groupname) will be fired. my user goes 2 pm online and take a look into that group, that I will delete old messages (triggered events until now for the related group). 1 hour later someone else will do something in that group.
At the end of the day a summary should be generated for all events that could happen, if no message for a subscriber exists nothing would be send.
@gigo1980
Thanks for sharing the use case,
You can use our digest feature
checkout the docs
https://docs.novu.co/workflows/digest
Hi @Pawan Jain I am still using digest. So the thing is more, one Person is writing into a chat a message, than we fire the notification. If the user delete this message it should be also deleted. For the broadcating in the chat room we are using topics. Each Chatroom is a topic and the members are subscribers.
And now we have the situation a person deletes this messages, how does this affect the generated notifications to all the subscribers?
So If I have 2 subscribers on a topic and send a message to the workflow I will get 2 messages with the same "transactionId"
One way is to send another notification informing this deletion to all except (who deleted)
What I can do is, I can query the message endpoint get all messages and than delete one by one.
or delete earlier sent notification by transactonid
At the moment there is only a endpoint like DELETE /v1/message/{messageId}
@gigo1980, you just advanced to level 1!
https://api.novu.co/api#/Messages/MessagesController_deleteMessagesByTransactionId
We added one more endpoint recently
not added in docs
ahh ok 🙂
Ok that I will double check the openApi spec.
But good to see that there is an openapi Spec, I still have created a Postman Collection for my personal use
And is the "actor" concept still described in the documentation? I think there is something missing to understand it.
Yeah checkout actor concept with topic documentation
https://docs.novu.co/subscribers/topics#exclude-actor-from-topic-trigger-event