Obtaining Digest Data
Hi all!
We have a use case where we want to show certain types of notification UI on the frontend based on the number of digested events. Our UI is a bit complex, so writing html in Novu's admin panel is impractical for us.
Is it possible to obtain any of the following:
- if a message that the user received is a digested one
- the payload of all the digested messages (the user receives just one payload)
Thanks!
3 Replies
@Khong
When you trigger workflow (having a digest step) first time, Novu creates digest and collect further triggers till digest duration and merge all event triggers into this digest.
So first job of immediate step after digest of this first event trigger has all the payload in events array
I see. Thank you!
@Pawan Jain Hello!
Is there a way to obtain those info without making an extra API call?
Let me lay out the full context, perhaps I'm missing something. We are developing a friend request notification feature with digest. You know, the standard
Person sent you a friend request
or Person and x people ...
. The thing is, if it's just one person, we will show an accept button in the notification toast UI, otherwise, we don't show anything.
I have looked into both @novu/headless and @novu/headless-center (using react). I went with using socket.on(WebSocketEventEnum.RECEIVED, () => {...})
. The problem is that the data is of type IMessage and does not contain the digest data and an additional API call to get the notification entity data is necessary.
So my question is: is there a different way of getting the digest data? Am I missing something here?