N
Novu2y ago
madhu

Please show me simple example of CURL request of creating trigger event by using the "topic" name?

I am not able finding the right payload to test the feature of creating trigger with topic { "name": "<template-name>", "to": [ "<topic-uuid-key> ], "payload": { <payload-data> } } #topic @Novu
9 Replies
--
--2y ago
Hi @madhu . Here is the documentation to trigger an event to a topic.
--
--2y ago
Topics | Novu
Novu offers a simple API providing an easy interface for triggering notifications to multiple subscribers at once. It is called Topics and allows the users to manage their bulk notifications without having to do complex loop implementations.
madhu
madhuOP2y ago
Hi @pablo.fernandez.otero I am not using node js, I need to create using the CURL (POSTMAN). Do you have any code snipper for it
--
--2y ago
Basically the payload is very similar to what's explained in the link I sent to you and how is explained in the API docs when triggering an event. https://docs.novu.co/api/trigger-event/
Trigger event - Novu API Reference
Trigger event is the main (and the only) way to send notification to subscribers. The trigger identifier is used to match the particular template associated with it. Additional information can be passed according the body interface below.
--
--2y ago
After you have a topic created to trigger an event, in the payload you need to fill the to property with the following object:
to: [{ type: TriggerRecipientsTypeEnum.TOPIC, topicKey: topicKey }]
to: [{ type: TriggerRecipientsTypeEnum.TOPIC, topicKey: topicKey }]
to takes an array of different elements. It can be subscriberIds, subscriber payload DTO and topics. To trigger the event to a topic you need to add inside of the array that structure. Just replacing the value of topicKey with the topic key you want to trigger the event to.
madhu
madhuOP2y ago
What is the equivalent value for my payload TriggerRecipientsTypeEnum.TOPIC
--
--2y ago
GitHub
novu/event.interface.ts at b5cf0dcb26f2e938b25a3c4799a794d7f0d5e4ea...
The open-source notification infrastructure for products. Add a notification center for your React, Vue and Angular apps 🚀 - novu/event.interface.ts at b5cf0dcb26f2e938b25a3c4799a794d7f0d5e4ea · no...
--
--2y ago
So basically your payload for the APi would be:
to: [{ type: 'topic', topicKey: '<YOUR_TOPIC_KEY>' }]
to: [{ type: 'topic', topicKey: '<YOUR_TOPIC_KEY>' }]
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server