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
Hi @madhu . Here is the documentation to trigger an event to a topic.
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.
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
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.
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
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.What is the equivalent value for my payload
TriggerRecipientsTypeEnum.TOPIC
The one I shared. The value of that enum key, you can find it here: https://github.com/novuhq/novu/blob/b5cf0dcb26f2e938b25a3c4799a794d7f0d5e4ea/libs/shared/src/dto/events/event.interface.ts
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...
So basically your payload for the APi would be:
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View