N
Novu9mo ago
karnativr

Add Buttons to notification

Does anyone know how to add buttons to notifcations for cta, cause I saw the object that is being passed to frontend,it has nested cta object which does have two fields - action and data. So I thought we can add buttons to notifications, please let me know how
5 Replies
Ask Inkeep
Ask Inkeep9mo ago
Hi @karnativr, 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: * React Get Started * How to use Novu to send notifications to a Slack channel * API Reference * Mark message action as seen -----------------------------
Ask Inkeep
Ask Inkeep9mo ago
Answer To add buttons to notifications for CTA (Call to Action), you can utilize the onActionClick callback function provided by Novu. This function is triggered when the user clicks on the action CTA buttons of the notification. You would need to implement your own logic within this function to handle the action performed by the CTA buttons. Here's a brief outline on how you could approach it: 1. Implement the onActionClick function in your notification component. 2. Within this function, you can define the behavior you want to achieve when a CTA button is clicked. For example, redirecting the user to a specific URL, which you'll get from the CTA object's data field. Please note, the documentation doesn't provide a direct example of defining CTAs within the notification payload itself. The handling of CTAs appears to be managed on the frontend side by responding to user interactions with the onActionClick callback function (1) . If you're looking to dynamically display or hide CTA buttons based on certain conditions (such as whether text is provided for them), you may need to customize your notification display logic. This might involve creating a custom notification center UI where you can add checks to show or hide buttons based on the presence of their text or other conditions (2) . For more detailed guidance, you might want to explore the documentation related to customizing the notification center UI and managing notification actions (1) , (2) .
Pawan Jain
Pawan Jain9mo ago
@karnativr Yes CTA action buttons can be added in in-app notifications. You will find this option in in-app editor
Pawan Jain
Pawan Jain9mo ago
No description
karnativr
karnativrOP9mo ago
okay I did not see this, my bad
Want results from more Discord servers?
Add your server