Updating Message CTA Button status using TransactionId
I am sending notifications which contains CTA buttons (Approve and Reject) to multiple subscribers using topic
So If one of the subscriber Approve it I want to remove the CTA buttons on other subscribers
Can someone let me know how to achieve this behaviour
For example:
I have two subscribers A and B
I sent a leave request notification to both A and B using topic named leave-request
A approves the leave request using CTA button provided in the notification
Now I want to hide the CTA buttons in B subscriber since the leave request is already been approved by subscriber A
10 Replies
We are talking about an In-App notification - right?
Yes @Emil
So you are looking for a way to dynamically update the content of the notifications based on the actions taken by the subscribers.
Interesting use case, checking.
Yes
Because in payroll systems we have admins with different roles and permission
For example
Admin (subscriber) can give permissions to the manager (subscriber) to approve the leave request
So when manager approves the leave request sent by an employee we can hide the cta buttons for manager but I still see them for admin notifications which is not expected
TransactionId is the only thing which is in common between them
And as per Open Spec I can only delete message dynamically by using transactionId but I cannot update it (for example removing CTA buttons) @Emil
@San, you just advanced to level 1!
Any possible solutions please?
Hi @San
In Novu, once a message (step notification) is sent to subscriber (user), it can not be modified. In your case, you have added CTA action buttons, approve and reject. In UI, you will have to handle the click event on these buttons using code. checkout this documentation for this.
So if user1 click on the approve button and you update the status of that event using above onActionClick handler in your backend. Again if user2 clicks on approve button, you can show popup saying that this is not allowed.
Let me know if you have any questions.
So you were saying we should handle it on our own and notification content cannot be changed based on the actions taken by other subscribers @Pawan Jain ?
It would be more beneficial if we could customize notification content dynamically, adjusting it based on the actions of other subscribers within the same topic.
Yes because actionClick is handled like this
https://docs.novu.co/notification-center/client/react/get-started#onactionclick
Thanks