Messages
List all messages
List all messages for the current environment. This API supports filtering by channel, subscriberId, and transactionId. This API returns a paginated list of messages.
GET
/
v1
/
messages
TypeScript
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.messages.retrieve({
contextKeys: [
"tenant:org-123",
"region:us-east-1",
],
});
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
MessagesControllerGetMessagesRequest req = new MessagesControllerGetMessagesRequest() {
ContextKeys = new List<string>() {
"tenant:org-123",
"region:us-east-1",
},
};
var res = await sdk.Messages.GetAsync(req);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$request = new Operations\MessagesControllerGetMessagesRequest(
contextKeys: [
'tenant:org-123',
'region:us-east-1',
],
);
$response = $sdk->messages->get(
request: $request
);
if ($response->messagesResponseDto !== null) {
// handle response
}from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.messages.retrieve(request={
"context_keys": [
"tenant:org-123",
"region:us-east-1",
],
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Messages.Retrieve(ctx, operations.MessagesControllerGetMessagesRequest{
ContextKeys: []string{
"tenant:org-123",
"region:us-east-1",
},
})
if err != nil {
log.Fatal(err)
}
if res.MessagesResponseDto != nil {
// handle response
}
}curl --request GET \
--url https://api.novu.co/v1/messages \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.novu.co/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.novu.co/v1/messages")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"hasMore": true,
"data": [
{
"_environmentId": "<string>",
"_organizationId": "<string>",
"_notificationId": "<string>",
"_subscriberId": "<string>",
"createdAt": "<string>",
"transactionId": "<string>",
"read": true,
"seen": true,
"cta": {
"type": "redirect",
"data": {
"url": "<string>"
},
"action": {
"buttons": [
{
"content": "<string>",
"resultContent": "<string>"
}
],
"result": {
"payload": {}
}
}
},
"_id": "<string>",
"_templateId": "<string>",
"_messageTemplateId": "<string>",
"subscriber": {
"subscriberId": "<string>",
"_organizationId": "<string>",
"_environmentId": "<string>",
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"channels": [
{
"credentials": {
"webhookUrl": "https://example.com/webhook",
"channel": "general",
"deviceTokens": [
"token1",
"token2",
"token3"
],
"alertUid": "12345-abcde",
"title": "Critical Alert",
"imageUrl": "https://example.com/image.png",
"state": "resolved",
"externalUrl": "https://example.com/details"
},
"_integrationId": "<string>",
"integrationIdentifier": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
},
"template": {
"name": "<string>",
"description": "<string>",
"active": true,
"draft": true,
"preferenceSettings": {
"email": true,
"sms": false,
"in_app": true,
"chat": false,
"push": true
},
"critical": true,
"tags": [
"<string>"
],
"steps": [
{
"_id": "<string>",
"uuid": "<string>",
"name": "<string>",
"_templateId": "<string>",
"active": true,
"shouldStopOnFail": true,
"template": {},
"filters": [
{
"isNegated": true,
"children": [
{
"field": "<string>",
"value": "<string>"
}
]
}
],
"_parentId": "<string>",
"metadata": {
"amount": 123,
"digestKey": "<string>",
"backoff": true,
"backoffAmount": 123,
"updateMode": true
},
"replyCallback": {
"active": true,
"url": "<string>"
},
"variants": [
{
"_id": "<string>",
"uuid": "<string>",
"name": "<string>",
"_templateId": "<string>",
"active": true,
"shouldStopOnFail": true,
"template": {},
"filters": [
{
"isNegated": true,
"children": [
{
"field": "<string>",
"value": "<string>"
}
]
}
],
"_parentId": "<string>",
"metadata": {
"amount": 123,
"digestKey": "<string>",
"backoff": true,
"backoffAmount": 123,
"updateMode": true
},
"replyCallback": {
"active": true,
"url": "<string>"
}
}
]
}
],
"_organizationId": "<string>",
"_creatorId": "<string>",
"_environmentId": "<string>",
"triggers": [
{
"type": "event",
"identifier": "<string>",
"variables": [
{
"name": "<string>"
}
],
"subscriberVariables": [
{
"name": "<string>"
}
]
}
],
"_notificationGroupId": "<string>",
"deleted": true,
"deletedAt": "<string>",
"deletedBy": "<string>",
"_id": "<string>",
"_parentId": "<string>",
"notificationGroup": {
"name": "<string>",
"_environmentId": "<string>",
"_organizationId": "<string>",
"_id": "<string>",
"_parentId": "<string>"
},
"data": {},
"workflowIntegrationStatus": {}
},
"templateIdentifier": "<string>",
"deliveredAt": [
"<string>"
],
"lastSeenDate": "<string>",
"lastReadDate": "<string>",
"content": [
{
"content": "<string>",
"url": "<string>",
"styles": {}
}
],
"subject": "<string>",
"snoozedUntil": "<string>",
"email": "<string>",
"phone": "<string>",
"directWebhookUrl": "<string>",
"providerId": "<string>",
"deviceTokens": [
"<string>"
],
"title": "<string>",
"_feedId": "<string>",
"errorId": "<string>",
"errorText": "<string>",
"payload": {},
"overrides": {},
"contextKeys": [
"tenant:org-123",
"region:us-east-1"
]
}
],
"pageSize": 123,
"page": 123,
"totalCount": 123
}{
"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",
"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
Query Parameters
Channel type through which the message is sent
Available options:
in_app, email, sms, chat, push Filter by exact context keys, order insensitive (format: "type:id")
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.messages.retrieve({
contextKeys: [
"tenant:org-123",
"region:us-east-1",
],
});
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
MessagesControllerGetMessagesRequest req = new MessagesControllerGetMessagesRequest() {
ContextKeys = new List<string>() {
"tenant:org-123",
"region:us-east-1",
},
};
var res = await sdk.Messages.GetAsync(req);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$request = new Operations\MessagesControllerGetMessagesRequest(
contextKeys: [
'tenant:org-123',
'region:us-east-1',
],
);
$response = $sdk->messages->get(
request: $request
);
if ($response->messagesResponseDto !== null) {
// handle response
}from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.messages.retrieve(request={
"context_keys": [
"tenant:org-123",
"region:us-east-1",
],
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Messages.Retrieve(ctx, operations.MessagesControllerGetMessagesRequest{
ContextKeys: []string{
"tenant:org-123",
"region:us-east-1",
},
})
if err != nil {
log.Fatal(err)
}
if res.MessagesResponseDto != nil {
// handle response
}
}curl --request GET \
--url https://api.novu.co/v1/messages \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.novu.co/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.novu.co/v1/messages")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"hasMore": true,
"data": [
{
"_environmentId": "<string>",
"_organizationId": "<string>",
"_notificationId": "<string>",
"_subscriberId": "<string>",
"createdAt": "<string>",
"transactionId": "<string>",
"read": true,
"seen": true,
"cta": {
"type": "redirect",
"data": {
"url": "<string>"
},
"action": {
"buttons": [
{
"content": "<string>",
"resultContent": "<string>"
}
],
"result": {
"payload": {}
}
}
},
"_id": "<string>",
"_templateId": "<string>",
"_messageTemplateId": "<string>",
"subscriber": {
"subscriberId": "<string>",
"_organizationId": "<string>",
"_environmentId": "<string>",
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"channels": [
{
"credentials": {
"webhookUrl": "https://example.com/webhook",
"channel": "general",
"deviceTokens": [
"token1",
"token2",
"token3"
],
"alertUid": "12345-abcde",
"title": "Critical Alert",
"imageUrl": "https://example.com/image.png",
"state": "resolved",
"externalUrl": "https://example.com/details"
},
"_integrationId": "<string>",
"integrationIdentifier": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
},
"template": {
"name": "<string>",
"description": "<string>",
"active": true,
"draft": true,
"preferenceSettings": {
"email": true,
"sms": false,
"in_app": true,
"chat": false,
"push": true
},
"critical": true,
"tags": [
"<string>"
],
"steps": [
{
"_id": "<string>",
"uuid": "<string>",
"name": "<string>",
"_templateId": "<string>",
"active": true,
"shouldStopOnFail": true,
"template": {},
"filters": [
{
"isNegated": true,
"children": [
{
"field": "<string>",
"value": "<string>"
}
]
}
],
"_parentId": "<string>",
"metadata": {
"amount": 123,
"digestKey": "<string>",
"backoff": true,
"backoffAmount": 123,
"updateMode": true
},
"replyCallback": {
"active": true,
"url": "<string>"
},
"variants": [
{
"_id": "<string>",
"uuid": "<string>",
"name": "<string>",
"_templateId": "<string>",
"active": true,
"shouldStopOnFail": true,
"template": {},
"filters": [
{
"isNegated": true,
"children": [
{
"field": "<string>",
"value": "<string>"
}
]
}
],
"_parentId": "<string>",
"metadata": {
"amount": 123,
"digestKey": "<string>",
"backoff": true,
"backoffAmount": 123,
"updateMode": true
},
"replyCallback": {
"active": true,
"url": "<string>"
}
}
]
}
],
"_organizationId": "<string>",
"_creatorId": "<string>",
"_environmentId": "<string>",
"triggers": [
{
"type": "event",
"identifier": "<string>",
"variables": [
{
"name": "<string>"
}
],
"subscriberVariables": [
{
"name": "<string>"
}
]
}
],
"_notificationGroupId": "<string>",
"deleted": true,
"deletedAt": "<string>",
"deletedBy": "<string>",
"_id": "<string>",
"_parentId": "<string>",
"notificationGroup": {
"name": "<string>",
"_environmentId": "<string>",
"_organizationId": "<string>",
"_id": "<string>",
"_parentId": "<string>"
},
"data": {},
"workflowIntegrationStatus": {}
},
"templateIdentifier": "<string>",
"deliveredAt": [
"<string>"
],
"lastSeenDate": "<string>",
"lastReadDate": "<string>",
"content": [
{
"content": "<string>",
"url": "<string>",
"styles": {}
}
],
"subject": "<string>",
"snoozedUntil": "<string>",
"email": "<string>",
"phone": "<string>",
"directWebhookUrl": "<string>",
"providerId": "<string>",
"deviceTokens": [
"<string>"
],
"title": "<string>",
"_feedId": "<string>",
"errorId": "<string>",
"errorText": "<string>",
"payload": {},
"overrides": {},
"contextKeys": [
"tenant:org-123",
"region:us-east-1"
]
}
],
"pageSize": 123,
"page": 123,
"totalCount": 123
}{
"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",
"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."