Events
Bulk trigger event
Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. The bulk API is limited to 100 events per request.
POST
/
v1
/
events
/
trigger
/
bulk
TypeScript
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.triggerBulk({
events: [
{
workflowId: "workflow_identifier",
payload: {
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides: {},
to: "SUBSCRIBER_ID",
},
{
workflowId: "workflow_identifier",
payload: {
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides: {},
to: "SUBSCRIBER_ID",
},
{
workflowId: "workflow_identifier",
payload: {
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides: {},
to: "SUBSCRIBER_ID",
},
],
});
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.TriggerBulkAsync(bulkTriggerEventDto: new BulkTriggerEventDto() {
Events = new List<TriggerEventRequestDto>() {
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
},
});
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$bulkTriggerEventDto = new Components\BulkTriggerEventDto(
events: [
new Components\TriggerEventRequestDto(
workflowId: 'workflow_identifier',
payload: [
'comment_id' => 'string',
'post' => [
'text' => 'string',
],
],
overrides: new Components\Overrides(),
to: 'SUBSCRIBER_ID',
),
new Components\TriggerEventRequestDto(
workflowId: 'workflow_identifier',
payload: [
'comment_id' => 'string',
'post' => [
'text' => 'string',
],
],
overrides: new Components\Overrides(),
to: 'SUBSCRIBER_ID',
),
new Components\TriggerEventRequestDto(
workflowId: 'workflow_identifier',
payload: [
'comment_id' => 'string',
'post' => [
'text' => 'string',
],
],
overrides: new Components\Overrides(),
to: 'SUBSCRIBER_ID',
),
],
);
$response = $sdk->triggerBulk(
bulkTriggerEventDto: $bulkTriggerEventDto
);
if ($response->triggerEventResponseDtos !== null) {
// handle response
}import novu_py
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.trigger_bulk(bulk_trigger_event_dto={
"events": [
novu_py.TriggerEventRequestDto(
workflow_id="workflow_identifier",
payload={
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides=novu_py.Overrides(),
to="SUBSCRIBER_ID",
),
novu_py.TriggerEventRequestDto(
workflow_id="workflow_identifier",
payload={
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides=novu_py.Overrides(),
to="SUBSCRIBER_ID",
),
novu_py.TriggerEventRequestDto(
workflow_id="workflow_identifier",
payload={
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides=novu_py.Overrides(),
to="SUBSCRIBER_ID",
),
],
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.TriggerBulk(ctx, components.BulkTriggerEventDto{
Events: []components.TriggerEventRequestDto{
components.TriggerEventRequestDto{
WorkflowID: "workflow_identifier",
Payload: map[string]any{
"comment_id": "string",
"post": map[string]any{
"text": "string",
},
},
Overrides: &components.Overrides{},
To: components.CreateToStr(
"SUBSCRIBER_ID",
),
},
components.TriggerEventRequestDto{
WorkflowID: "workflow_identifier",
Payload: map[string]any{
"comment_id": "string",
"post": map[string]any{
"text": "string",
},
},
Overrides: &components.Overrides{},
To: components.CreateToStr(
"SUBSCRIBER_ID",
),
},
components.TriggerEventRequestDto{
WorkflowID: "workflow_identifier",
Payload: map[string]any{
"comment_id": "string",
"post": map[string]any{
"text": "string",
},
},
Overrides: &components.Overrides{},
To: components.CreateToStr(
"SUBSCRIBER_ID",
),
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.TriggerEventResponseDtos != nil {
// handle response
}
}curl --request POST \
--url https://api.novu.co/v1/events/trigger/bulk \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"name": "workflow_identifier",
"to": [
{
"subscriberId": "<string>",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phone": "+1234567890",
"avatar": "https://example.com/avatar.jpg",
"locale": "en-US",
"timezone": "America/New_York",
"data": {},
"channels": [
{
"credentials": {
"webhookUrl": "<string>",
"deviceTokens": [
"<string>"
]
},
"integrationIdentifier": "<string>"
}
]
}
],
"payload": {
"comment_id": "string",
"post": {
"text": "string"
}
},
"bridgeUrl": "https://your-tunnel.novu.co/api/novu",
"overrides": {
"steps": {
"email-step": {
"providers": {
"sendgrid": {
"templateId": "1234567890"
}
},
"layoutId": "step-specific-layout"
}
},
"channels": {
"email": {
"layoutId": "promotional-layout-2024"
}
},
"providers": {
"sendgrid": {
"templateId": "1234567890"
}
},
"email": {},
"push": {},
"sms": {},
"chat": {},
"layoutIdentifier": "<string>"
},
"transactionId": "<string>",
"actor": "<string>",
"tenant": "<string>",
"context": {}
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
name: 'workflow_identifier',
to: [
{
subscriberId: '<string>',
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
phone: '+1234567890',
avatar: 'https://example.com/avatar.jpg',
locale: 'en-US',
timezone: 'America/New_York',
data: {},
channels: [
{
credentials: {webhookUrl: '<string>', deviceTokens: ['<string>']},
integrationIdentifier: '<string>'
}
]
}
],
payload: {comment_id: 'string', post: {text: 'string'}},
bridgeUrl: 'https://your-tunnel.novu.co/api/novu',
overrides: {
steps: {
'email-step': {
providers: {sendgrid: {templateId: '1234567890'}},
layoutId: 'step-specific-layout'
}
},
channels: {email: {layoutId: 'promotional-layout-2024'}},
providers: {sendgrid: {templateId: '1234567890'}},
email: {},
push: {},
sms: {},
chat: {},
layoutIdentifier: '<string>'
},
transactionId: '<string>',
actor: '<string>',
tenant: '<string>',
context: {}
}
]
})
};
fetch('https://api.novu.co/v1/events/trigger/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.novu.co/v1/events/trigger/bulk")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"name\": \"workflow_identifier\",\n \"to\": [\n {\n \"subscriberId\": \"<string>\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"avatar\": \"https://example.com/avatar.jpg\",\n \"locale\": \"en-US\",\n \"timezone\": \"America/New_York\",\n \"data\": {},\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"<string>\",\n \"deviceTokens\": [\n \"<string>\"\n ]\n },\n \"integrationIdentifier\": \"<string>\"\n }\n ]\n }\n ],\n \"payload\": {\n \"comment_id\": \"string\",\n \"post\": {\n \"text\": \"string\"\n }\n },\n \"bridgeUrl\": \"https://your-tunnel.novu.co/api/novu\",\n \"overrides\": {\n \"steps\": {\n \"email-step\": {\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"layoutId\": \"step-specific-layout\"\n }\n },\n \"channels\": {\n \"email\": {\n \"layoutId\": \"promotional-layout-2024\"\n }\n },\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"email\": {},\n \"push\": {},\n \"sms\": {},\n \"chat\": {},\n \"layoutIdentifier\": \"<string>\"\n },\n \"transactionId\": \"<string>\",\n \"actor\": \"<string>\",\n \"tenant\": \"<string>\",\n \"context\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/events/trigger/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"name\": \"workflow_identifier\",\n \"to\": [\n {\n \"subscriberId\": \"<string>\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"avatar\": \"https://example.com/avatar.jpg\",\n \"locale\": \"en-US\",\n \"timezone\": \"America/New_York\",\n \"data\": {},\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"<string>\",\n \"deviceTokens\": [\n \"<string>\"\n ]\n },\n \"integrationIdentifier\": \"<string>\"\n }\n ]\n }\n ],\n \"payload\": {\n \"comment_id\": \"string\",\n \"post\": {\n \"text\": \"string\"\n }\n },\n \"bridgeUrl\": \"https://your-tunnel.novu.co/api/novu\",\n \"overrides\": {\n \"steps\": {\n \"email-step\": {\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"layoutId\": \"step-specific-layout\"\n }\n },\n \"channels\": {\n \"email\": {\n \"layoutId\": \"promotional-layout-2024\"\n }\n },\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"email\": {},\n \"push\": {},\n \"sms\": {},\n \"chat\": {},\n \"layoutIdentifier\": \"<string>\"\n },\n \"transactionId\": \"<string>\",\n \"actor\": \"<string>\",\n \"tenant\": \"<string>\",\n \"context\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"acknowledged": true,
"error": [
"<string>"
],
"transactionId": "<string>",
"activityFeedLink": "<string>",
"jobData": {}
}
]{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"type": "PAYLOAD_VALIDATION_ERROR",
"errors": [
{
"field": "user.name",
"message": "must have required property 'name'",
"value": {
"age": 25
},
"schemaPath": "#/required"
}
],
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "number"
}
},
"required": [
"name"
]
}
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."Authorizations
API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".
Headers
A header for idempotency purposes
Body
application/json
Show child attributes
Show child attributes
Response
Created
Indicates whether the trigger was acknowledged or not
Status of the trigger
Available options:
error, trigger_not_active, no_workflow_active_steps_defined, no_workflow_steps_defined, processed, no_tenant_found, invalid_recipients In case of an error, this field will contain the error message(s)
The returned transaction ID of the trigger
Link to the activity feed for this trigger event
Was this page helpful?
⌘I
TypeScript
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.triggerBulk({
events: [
{
workflowId: "workflow_identifier",
payload: {
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides: {},
to: "SUBSCRIBER_ID",
},
{
workflowId: "workflow_identifier",
payload: {
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides: {},
to: "SUBSCRIBER_ID",
},
{
workflowId: "workflow_identifier",
payload: {
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides: {},
to: "SUBSCRIBER_ID",
},
],
});
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.TriggerBulkAsync(bulkTriggerEventDto: new BulkTriggerEventDto() {
Events = new List<TriggerEventRequestDto>() {
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
new TriggerEventRequestDto() {
WorkflowId = "workflow_identifier",
Payload = new Dictionary<string, object>() {
{ "comment_id", "string" },
{ "post", new Dictionary<string, object>() {
{ "text", "string" },
} },
},
Overrides = new Overrides() {},
To = To.CreateStr(
"SUBSCRIBER_ID"
),
},
},
});
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$bulkTriggerEventDto = new Components\BulkTriggerEventDto(
events: [
new Components\TriggerEventRequestDto(
workflowId: 'workflow_identifier',
payload: [
'comment_id' => 'string',
'post' => [
'text' => 'string',
],
],
overrides: new Components\Overrides(),
to: 'SUBSCRIBER_ID',
),
new Components\TriggerEventRequestDto(
workflowId: 'workflow_identifier',
payload: [
'comment_id' => 'string',
'post' => [
'text' => 'string',
],
],
overrides: new Components\Overrides(),
to: 'SUBSCRIBER_ID',
),
new Components\TriggerEventRequestDto(
workflowId: 'workflow_identifier',
payload: [
'comment_id' => 'string',
'post' => [
'text' => 'string',
],
],
overrides: new Components\Overrides(),
to: 'SUBSCRIBER_ID',
),
],
);
$response = $sdk->triggerBulk(
bulkTriggerEventDto: $bulkTriggerEventDto
);
if ($response->triggerEventResponseDtos !== null) {
// handle response
}import novu_py
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.trigger_bulk(bulk_trigger_event_dto={
"events": [
novu_py.TriggerEventRequestDto(
workflow_id="workflow_identifier",
payload={
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides=novu_py.Overrides(),
to="SUBSCRIBER_ID",
),
novu_py.TriggerEventRequestDto(
workflow_id="workflow_identifier",
payload={
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides=novu_py.Overrides(),
to="SUBSCRIBER_ID",
),
novu_py.TriggerEventRequestDto(
workflow_id="workflow_identifier",
payload={
"comment_id": "string",
"post": {
"text": "string",
},
},
overrides=novu_py.Overrides(),
to="SUBSCRIBER_ID",
),
],
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.TriggerBulk(ctx, components.BulkTriggerEventDto{
Events: []components.TriggerEventRequestDto{
components.TriggerEventRequestDto{
WorkflowID: "workflow_identifier",
Payload: map[string]any{
"comment_id": "string",
"post": map[string]any{
"text": "string",
},
},
Overrides: &components.Overrides{},
To: components.CreateToStr(
"SUBSCRIBER_ID",
),
},
components.TriggerEventRequestDto{
WorkflowID: "workflow_identifier",
Payload: map[string]any{
"comment_id": "string",
"post": map[string]any{
"text": "string",
},
},
Overrides: &components.Overrides{},
To: components.CreateToStr(
"SUBSCRIBER_ID",
),
},
components.TriggerEventRequestDto{
WorkflowID: "workflow_identifier",
Payload: map[string]any{
"comment_id": "string",
"post": map[string]any{
"text": "string",
},
},
Overrides: &components.Overrides{},
To: components.CreateToStr(
"SUBSCRIBER_ID",
),
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.TriggerEventResponseDtos != nil {
// handle response
}
}curl --request POST \
--url https://api.novu.co/v1/events/trigger/bulk \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"name": "workflow_identifier",
"to": [
{
"subscriberId": "<string>",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phone": "+1234567890",
"avatar": "https://example.com/avatar.jpg",
"locale": "en-US",
"timezone": "America/New_York",
"data": {},
"channels": [
{
"credentials": {
"webhookUrl": "<string>",
"deviceTokens": [
"<string>"
]
},
"integrationIdentifier": "<string>"
}
]
}
],
"payload": {
"comment_id": "string",
"post": {
"text": "string"
}
},
"bridgeUrl": "https://your-tunnel.novu.co/api/novu",
"overrides": {
"steps": {
"email-step": {
"providers": {
"sendgrid": {
"templateId": "1234567890"
}
},
"layoutId": "step-specific-layout"
}
},
"channels": {
"email": {
"layoutId": "promotional-layout-2024"
}
},
"providers": {
"sendgrid": {
"templateId": "1234567890"
}
},
"email": {},
"push": {},
"sms": {},
"chat": {},
"layoutIdentifier": "<string>"
},
"transactionId": "<string>",
"actor": "<string>",
"tenant": "<string>",
"context": {}
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
name: 'workflow_identifier',
to: [
{
subscriberId: '<string>',
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
phone: '+1234567890',
avatar: 'https://example.com/avatar.jpg',
locale: 'en-US',
timezone: 'America/New_York',
data: {},
channels: [
{
credentials: {webhookUrl: '<string>', deviceTokens: ['<string>']},
integrationIdentifier: '<string>'
}
]
}
],
payload: {comment_id: 'string', post: {text: 'string'}},
bridgeUrl: 'https://your-tunnel.novu.co/api/novu',
overrides: {
steps: {
'email-step': {
providers: {sendgrid: {templateId: '1234567890'}},
layoutId: 'step-specific-layout'
}
},
channels: {email: {layoutId: 'promotional-layout-2024'}},
providers: {sendgrid: {templateId: '1234567890'}},
email: {},
push: {},
sms: {},
chat: {},
layoutIdentifier: '<string>'
},
transactionId: '<string>',
actor: '<string>',
tenant: '<string>',
context: {}
}
]
})
};
fetch('https://api.novu.co/v1/events/trigger/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.novu.co/v1/events/trigger/bulk")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"name\": \"workflow_identifier\",\n \"to\": [\n {\n \"subscriberId\": \"<string>\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"avatar\": \"https://example.com/avatar.jpg\",\n \"locale\": \"en-US\",\n \"timezone\": \"America/New_York\",\n \"data\": {},\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"<string>\",\n \"deviceTokens\": [\n \"<string>\"\n ]\n },\n \"integrationIdentifier\": \"<string>\"\n }\n ]\n }\n ],\n \"payload\": {\n \"comment_id\": \"string\",\n \"post\": {\n \"text\": \"string\"\n }\n },\n \"bridgeUrl\": \"https://your-tunnel.novu.co/api/novu\",\n \"overrides\": {\n \"steps\": {\n \"email-step\": {\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"layoutId\": \"step-specific-layout\"\n }\n },\n \"channels\": {\n \"email\": {\n \"layoutId\": \"promotional-layout-2024\"\n }\n },\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"email\": {},\n \"push\": {},\n \"sms\": {},\n \"chat\": {},\n \"layoutIdentifier\": \"<string>\"\n },\n \"transactionId\": \"<string>\",\n \"actor\": \"<string>\",\n \"tenant\": \"<string>\",\n \"context\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/events/trigger/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"name\": \"workflow_identifier\",\n \"to\": [\n {\n \"subscriberId\": \"<string>\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1234567890\",\n \"avatar\": \"https://example.com/avatar.jpg\",\n \"locale\": \"en-US\",\n \"timezone\": \"America/New_York\",\n \"data\": {},\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"<string>\",\n \"deviceTokens\": [\n \"<string>\"\n ]\n },\n \"integrationIdentifier\": \"<string>\"\n }\n ]\n }\n ],\n \"payload\": {\n \"comment_id\": \"string\",\n \"post\": {\n \"text\": \"string\"\n }\n },\n \"bridgeUrl\": \"https://your-tunnel.novu.co/api/novu\",\n \"overrides\": {\n \"steps\": {\n \"email-step\": {\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"layoutId\": \"step-specific-layout\"\n }\n },\n \"channels\": {\n \"email\": {\n \"layoutId\": \"promotional-layout-2024\"\n }\n },\n \"providers\": {\n \"sendgrid\": {\n \"templateId\": \"1234567890\"\n }\n },\n \"email\": {},\n \"push\": {},\n \"sms\": {},\n \"chat\": {},\n \"layoutIdentifier\": \"<string>\"\n },\n \"transactionId\": \"<string>\",\n \"actor\": \"<string>\",\n \"tenant\": \"<string>\",\n \"context\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"acknowledged": true,
"error": [
"<string>"
],
"transactionId": "<string>",
"activityFeedLink": "<string>",
"jobData": {}
}
]{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"type": "PAYLOAD_VALIDATION_ERROR",
"errors": [
{
"field": "user.name",
"message": "must have required property 'name'",
"value": {
"age": 25
},
"schemaPath": "#/required"
}
],
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "number"
}
},
"required": [
"name"
]
}
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."