N
Novu5mo ago
_7eo.

feed id

how i get feedid from notification in novu headless?
5 Replies
Ask Inkeep
Ask Inkeep5mo ago
Hi @_7eo., I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Headless API Reference * How to use Headless Notification Center * Get Started * Headless JavaScript Service -----------------------------
Ask Inkeep
Ask Inkeep5mo ago
Answer To retrieve the feedId when using Novu's headless notification service, you generally need to have structured your notifications to include this information within the payload or data structure of the notification itself. The feedId is not automatically part of a notification's data unless explicitly included during the notification setup. If you are setting up notifications and need to specify or retrieve the feedId, you would include it in the payload when you define the notification trigger in your backend or service setup. Here's a conceptual example of how you might include a feedId in your notification payload:
novu.trigger('notification-event', {
to: {
subscriberId: 'user-id'
},
payload: {
feedId: 'your-feed-id',
additionalData: 'your-data'
}
});
novu.trigger('notification-event', {
to: {
subscriberId: 'user-id'
},
payload: {
feedId: 'your-feed-id',
additionalData: 'your-data'
}
});
When fetching notifications using the headless API, if the feedId is included in the notification's payload, you can extract it from the fetched notification data. Here’s a basic example of fetching notifications and logging the feedId:
headlessService.fetchNotifications({
listener: (result) => {
result.data.forEach(notification => {
console.log(notification.payload.feedId); // Accessing feedId
});
}
});
headlessService.fetchNotifications({
listener: (result) => {
result.data.forEach(notification => {
console.log(notification.payload.feedId); // Accessing feedId
});
}
});
Please ensure your notification structure and fetching logic align with your implementation requirements. You may need to adjust the code snippets above according to your actual setup and the specific details of how you manage notifications in Novu. For more detailed guidance and API specifics, you can refer to the Novu documentation on handling notifications (1) .
Ask Inkeep
Ask Inkeep5mo ago
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
Pawan Jain
Pawan Jain5mo ago
@_7eo. do you need help in this?
_7eo.
_7eo.5mo ago
i managed to send the feedid in my trigger thanks
Want results from more Discord servers?
Add your server