N
Novu2mo ago
Jakob

Triggering events on topics

probably I am missing something, I am read the API documentation https://docs.novu.co/api-reference/events/trigger-event as well the ruby SDK implementation and don't see it documented however if I read the e2e tests https://github.com/novuhq/novu/blob/6ffc13f105e3661ea0925be07691307b932473b3/apps/api/src/app/events/e2e/trigger-event-topic.e2e.ts it is covered and uses the the events/trigger endpoint is this the intended way ? is the documentation behind?
5 Replies
Pawan Jain
Pawan Jain2mo ago
@Jakob
as well the ruby SDK implementation and don't see it documented
Could you please share more details on this? ruby sdk event trigger docs https://github.com/novuhq/novu-ruby?tab=readme-ov-file#events
GitHub
GitHub - novuhq/novu-ruby: Ruby SDK for Novu - The open-source noti...
Ruby SDK for Novu - The open-source notification infrastructure for engineers. 🚀 - novuhq/novu-ruby
Jakob
JakobOP2mo ago
how does this look like for when sending a event to a topic rather than the subscriber ID payload = { 'name' => 'Trigger1', 'payload' => { # optional 'first-name' => 'Adam' # optional }, 'to' => { 'subscriberId' => '7789' }, 'transactionId' => '89kjfke9893' #optional } client.trigger_event(payload)
Pawan Jain
Pawan Jain2mo ago
Apologies, I missed topic part Looks like sdk does not support sending to topic. Could you use our api directly?
curl -L -X POST 'https://api.novu.co/v1/events/trigger' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: ApiKey <SECRET_KEY>' \
-d '{
"name": "<workflow_trigger-identifier>",
"to": [
{
"type": "Topic",
"topicKey": "second-topic"
}
]
}'
curl -L -X POST 'https://api.novu.co/v1/events/trigger' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: ApiKey <SECRET_KEY>' \
-d '{
"name": "<workflow_trigger-identifier>",
"to": [
{
"type": "Topic",
"topicKey": "second-topic"
}
]
}'
Jakob
JakobOP2mo ago
ok yes that will work from the Api docs themselves it was not clear that "to" can be a topic as the samples are all about subscriberId
Jakob
JakobOP2mo ago
No description
Want results from more Discord servers?
Add your server