Skip to main content
GET
/
v1
/
messages
PHP
declare(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
}
{
  "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
}

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Query Parameters

channel
enum<string>

Channel type through which the message is sent

Available options:
in_app,
email,
sms,
chat,
push
subscriberId
string
transactionId
string[]
contextKeys
string[]

Filter by exact context keys, order insensitive (format: "type:id")

page
number
default:0
limit
number
default:10

Response

hasMore
boolean
required

Indicates if there are more messages available

data
object[]
required

List of messages

pageSize
number
required

Number of messages per page

page
number
required

Current page number

totalCount
number

Total number of messages available