import { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
await novu.events.broadcast("<WORKFLOW_TRIGGER_IDENTIFIER>", {
payload: {
customKey: "customValue",
customKey1: {
nestedkey1: "nestedValue1"
}
},
overrides: {
email: {
from: "support@novu.co"
}
},
tenant: "tenantIdentifier"
})
use Novu\SDK\Novu;
$novu = new Novu(<NOVU_API_KEY>);
$novu->broadcastEvent([
'name' => '<WORKFLOW_TRIGGER_IDENTIFIER>',
'payload' => ['customVariables' => 'Hello'],
'transactionId' => '<REPLACE_WITH_TRANSACTION_ID>'
])->toArray();
require 'novu'
client = Novu::Client.new('<NOVU_API_KEY>')
payload = {
'name' => 'Trigger',
'payload' => {
'first-name' => 'Adam',
'last-name' => 'Eve'
},
'transactionId' => 'sw900999as' #optional
}
client.broadcast_event(payload)
curl -X POST https://api.novu.co/v1/events/trigger/broadcast \
-H "Authorization: ApiKey <NOVU_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "<WORKFLOW_TRIGGER_IDENTIFIER>",
"payload": {
"customKey": "customValue",
"customKey1": {
"nestedkey1": "nestedValue1"
}
},
"overrides": {
"email": {
"from": "support@novu.co"
}
},
"tenant": "tenantIdentifier"
}'
package main
import (
"context"
"fmt"
novu "github.com/novuhq/go-novu/lib"
"log"
)
func main() {
apiKey := "<NOVU_API_KEY>"
ctx := context.Background()
novuClient := novu.NewAPIClient(apiKey, &novu.Config{})
name := interface{}{"<WORKFLOW_TRIGGER_IDENTIFIER>"}
payload := map[string]interface{}{
"name": "Hello World",
"organization": map[string]interface{}{
"logo": "https://happycorp.com/logo.png",
},
}
data := novu.BroadcastEventToAll{Name: name, Payload: payload}
resp, err := novuClient.EventApi.BroadcastToAll(ctx, data)
if err != nil {
log.Fatal("novu error", err.Error())
return
}
}
from novu.api import EventApi
url = "https://api.novu.co"
api_key = "<NOVU_API_KEY>"
novu = EventApi(url, api_key).broadcast(
name="<WORKFLOW_TRIGGER_IDENTIFIER>",
payload={"customVariable": "value"}, # Optional
)
import co.novu.common.base.Novu;
import co.novu.api.common.SubscriberRequest;
import co.novu.api.events.requests.TriggerEventRequest;
import co.novu.api.events.responses.TriggerEventResponse;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_API_KEY>";
Novu novu = new Novu(apiKey);
SubscriberRequest subscriberRequest = new SubscriberRequest();
subscriberRequest.setEmail("<EMAIL_ADDRESS>");
subscriberRequest.setFirstName("<FIRST_NAME>");
subscriberRequest.setLastName("<LAST_NAME>");
subscriberRequest.setPhone("<PHONE_NUMBER>");
subscriberRequest.setAvatar("<AVATAR>");
subscriberRequest.setSubscriberId("<SUBSCRIBER_ID>");
TriggerEventRequest triggerEventRequest = new TriggerEventRequest();
triggerEventRequest.setName("<NAME>");
triggerEventRequest.setTo(subscriberRequest);
triggerEventRequest.setPayload(Collections.singletonMap("<CUSTOM_VARIABLE_NAME>", "<CUSTOM_VARIABLE_VALUE>"));
TriggerEventResponse response = novu.broadcastEvent(triggerEventRequest);
}
}
using Novu.DTO;
using Novu.Models;
using Novu;
var novuConfiguration = new NovuClientConfiguration
{
/**
* Defaults to https://api.novu.co/v1
*/
Url = "https://novu-api.my-domain.com/v1",
ApiKey = "12345",
};
var novu = new NovuClient(novuConfiguration);
var testRecord = new TestRecord
{
Message = "This is a test message"
};
var dto = new EventTriggerDataDto()
{
EventName = "<WORKFLOW_TRIGGER_IDENTIFIER>",
To =
{
SubscriberId = "<UNIQUE_SUBSCRIBER_IDENTIFIER>"
},
Payload = testRecord
};
var trigger = await novu.Event.TriggerBroadcastAsync(dto);
{
"data": {
"acknowledged": true,
"status": "processed",
"transactionId": "string"
}
}
Events
Broadcast event to all
Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. In the future could be used to trigger events to a subset of subscribers based on defined filters.
POST
/
v1
/
events
/
trigger
/
broadcast
import { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
await novu.events.broadcast("<WORKFLOW_TRIGGER_IDENTIFIER>", {
payload: {
customKey: "customValue",
customKey1: {
nestedkey1: "nestedValue1"
}
},
overrides: {
email: {
from: "support@novu.co"
}
},
tenant: "tenantIdentifier"
})
use Novu\SDK\Novu;
$novu = new Novu(<NOVU_API_KEY>);
$novu->broadcastEvent([
'name' => '<WORKFLOW_TRIGGER_IDENTIFIER>',
'payload' => ['customVariables' => 'Hello'],
'transactionId' => '<REPLACE_WITH_TRANSACTION_ID>'
])->toArray();
require 'novu'
client = Novu::Client.new('<NOVU_API_KEY>')
payload = {
'name' => 'Trigger',
'payload' => {
'first-name' => 'Adam',
'last-name' => 'Eve'
},
'transactionId' => 'sw900999as' #optional
}
client.broadcast_event(payload)
curl -X POST https://api.novu.co/v1/events/trigger/broadcast \
-H "Authorization: ApiKey <NOVU_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "<WORKFLOW_TRIGGER_IDENTIFIER>",
"payload": {
"customKey": "customValue",
"customKey1": {
"nestedkey1": "nestedValue1"
}
},
"overrides": {
"email": {
"from": "support@novu.co"
}
},
"tenant": "tenantIdentifier"
}'
package main
import (
"context"
"fmt"
novu "github.com/novuhq/go-novu/lib"
"log"
)
func main() {
apiKey := "<NOVU_API_KEY>"
ctx := context.Background()
novuClient := novu.NewAPIClient(apiKey, &novu.Config{})
name := interface{}{"<WORKFLOW_TRIGGER_IDENTIFIER>"}
payload := map[string]interface{}{
"name": "Hello World",
"organization": map[string]interface{}{
"logo": "https://happycorp.com/logo.png",
},
}
data := novu.BroadcastEventToAll{Name: name, Payload: payload}
resp, err := novuClient.EventApi.BroadcastToAll(ctx, data)
if err != nil {
log.Fatal("novu error", err.Error())
return
}
}
from novu.api import EventApi
url = "https://api.novu.co"
api_key = "<NOVU_API_KEY>"
novu = EventApi(url, api_key).broadcast(
name="<WORKFLOW_TRIGGER_IDENTIFIER>",
payload={"customVariable": "value"}, # Optional
)
import co.novu.common.base.Novu;
import co.novu.api.common.SubscriberRequest;
import co.novu.api.events.requests.TriggerEventRequest;
import co.novu.api.events.responses.TriggerEventResponse;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_API_KEY>";
Novu novu = new Novu(apiKey);
SubscriberRequest subscriberRequest = new SubscriberRequest();
subscriberRequest.setEmail("<EMAIL_ADDRESS>");
subscriberRequest.setFirstName("<FIRST_NAME>");
subscriberRequest.setLastName("<LAST_NAME>");
subscriberRequest.setPhone("<PHONE_NUMBER>");
subscriberRequest.setAvatar("<AVATAR>");
subscriberRequest.setSubscriberId("<SUBSCRIBER_ID>");
TriggerEventRequest triggerEventRequest = new TriggerEventRequest();
triggerEventRequest.setName("<NAME>");
triggerEventRequest.setTo(subscriberRequest);
triggerEventRequest.setPayload(Collections.singletonMap("<CUSTOM_VARIABLE_NAME>", "<CUSTOM_VARIABLE_VALUE>"));
TriggerEventResponse response = novu.broadcastEvent(triggerEventRequest);
}
}
using Novu.DTO;
using Novu.Models;
using Novu;
var novuConfiguration = new NovuClientConfiguration
{
/**
* Defaults to https://api.novu.co/v1
*/
Url = "https://novu-api.my-domain.com/v1",
ApiKey = "12345",
};
var novu = new NovuClient(novuConfiguration);
var testRecord = new TestRecord
{
Message = "This is a test message"
};
var dto = new EventTriggerDataDto()
{
EventName = "<WORKFLOW_TRIGGER_IDENTIFIER>",
To =
{
SubscriberId = "<UNIQUE_SUBSCRIBER_IDENTIFIER>"
},
Payload = testRecord
};
var trigger = await novu.Event.TriggerBroadcastAsync(dto);
{
"data": {
"acknowledged": true,
"status": "processed",
"transactionId": "string"
}
}
Enter your API key in the
Authorization field like the example shown below:E.g ApiKey 18d2e625f05d80eimport { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
await novu.events.broadcast("<WORKFLOW_TRIGGER_IDENTIFIER>", {
payload: {
customKey: "customValue",
customKey1: {
nestedkey1: "nestedValue1"
}
},
overrides: {
email: {
from: "support@novu.co"
}
},
tenant: "tenantIdentifier"
})
use Novu\SDK\Novu;
$novu = new Novu(<NOVU_API_KEY>);
$novu->broadcastEvent([
'name' => '<WORKFLOW_TRIGGER_IDENTIFIER>',
'payload' => ['customVariables' => 'Hello'],
'transactionId' => '<REPLACE_WITH_TRANSACTION_ID>'
])->toArray();
require 'novu'
client = Novu::Client.new('<NOVU_API_KEY>')
payload = {
'name' => 'Trigger',
'payload' => {
'first-name' => 'Adam',
'last-name' => 'Eve'
},
'transactionId' => 'sw900999as' #optional
}
client.broadcast_event(payload)
curl -X POST https://api.novu.co/v1/events/trigger/broadcast \
-H "Authorization: ApiKey <NOVU_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "<WORKFLOW_TRIGGER_IDENTIFIER>",
"payload": {
"customKey": "customValue",
"customKey1": {
"nestedkey1": "nestedValue1"
}
},
"overrides": {
"email": {
"from": "support@novu.co"
}
},
"tenant": "tenantIdentifier"
}'
package main
import (
"context"
"fmt"
novu "github.com/novuhq/go-novu/lib"
"log"
)
func main() {
apiKey := "<NOVU_API_KEY>"
ctx := context.Background()
novuClient := novu.NewAPIClient(apiKey, &novu.Config{})
name := interface{}{"<WORKFLOW_TRIGGER_IDENTIFIER>"}
payload := map[string]interface{}{
"name": "Hello World",
"organization": map[string]interface{}{
"logo": "https://happycorp.com/logo.png",
},
}
data := novu.BroadcastEventToAll{Name: name, Payload: payload}
resp, err := novuClient.EventApi.BroadcastToAll(ctx, data)
if err != nil {
log.Fatal("novu error", err.Error())
return
}
}
from novu.api import EventApi
url = "https://api.novu.co"
api_key = "<NOVU_API_KEY>"
novu = EventApi(url, api_key).broadcast(
name="<WORKFLOW_TRIGGER_IDENTIFIER>",
payload={"customVariable": "value"}, # Optional
)
import co.novu.common.base.Novu;
import co.novu.api.common.SubscriberRequest;
import co.novu.api.events.requests.TriggerEventRequest;
import co.novu.api.events.responses.TriggerEventResponse;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_API_KEY>";
Novu novu = new Novu(apiKey);
SubscriberRequest subscriberRequest = new SubscriberRequest();
subscriberRequest.setEmail("<EMAIL_ADDRESS>");
subscriberRequest.setFirstName("<FIRST_NAME>");
subscriberRequest.setLastName("<LAST_NAME>");
subscriberRequest.setPhone("<PHONE_NUMBER>");
subscriberRequest.setAvatar("<AVATAR>");
subscriberRequest.setSubscriberId("<SUBSCRIBER_ID>");
TriggerEventRequest triggerEventRequest = new TriggerEventRequest();
triggerEventRequest.setName("<NAME>");
triggerEventRequest.setTo(subscriberRequest);
triggerEventRequest.setPayload(Collections.singletonMap("<CUSTOM_VARIABLE_NAME>", "<CUSTOM_VARIABLE_VALUE>"));
TriggerEventResponse response = novu.broadcastEvent(triggerEventRequest);
}
}
using Novu.DTO;
using Novu.Models;
using Novu;
var novuConfiguration = new NovuClientConfiguration
{
/**
* Defaults to https://api.novu.co/v1
*/
Url = "https://novu-api.my-domain.com/v1",
ApiKey = "12345",
};
var novu = new NovuClient(novuConfiguration);
var testRecord = new TestRecord
{
Message = "This is a test message"
};
var dto = new EventTriggerDataDto()
{
EventName = "<WORKFLOW_TRIGGER_IDENTIFIER>",
To =
{
SubscriberId = "<UNIQUE_SUBSCRIBER_IDENTIFIER>"
},
Payload = testRecord
};
var trigger = await novu.Event.TriggerBroadcastAsync(dto);
{
"data": {
"acknowledged": true,
"status": "processed",
"transactionId": "string"
}
}
Authorizations
Body
application/json
The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
Example:
{
"comment_id": "string",
"post": { "text": "string" }
}
Response
Ok
Was this page helpful?