Get messages

Returns a list of messages, could paginate using the page query parameter

GET
/v1/messages

Authorization

Authorization<token>

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

In: header

Query Parameters

channelstring

Channel type through which the message is sent

Value in: "in_app" | "email" | "sms" | "chat" | "push"
subscriberIdstring
transactionIdarray<string>
pagenumber
Default: 0
limitnumber
Default: 10

Header Parameters

idempotency-keystring

A header for idempotency purposes

Response Body

totalCountnumber

Total number of messages available

hasMoreRequiredboolean

Indicates if there are more messages available

dataRequiredarray<object>

List of messages

pageSizeRequirednumber

Number of messages per page

pageRequirednumber

Current page number

export interface Response {
  /**
   * Total number of messages available
   */
  totalCount?: number;
  /**
   * Indicates if there are more messages available
   */
  hasMore: boolean;
  /**
   * List of messages
   */
  data: MessageResponseDto[];
  /**
   * Number of messages per page
   */
  pageSize: number;
  /**
   * Current page number
   */
  page: number;
}
export interface MessageResponseDto {
  /**
   * Unique identifier for the message
   */
  _id?: string;
  /**
   * Template ID associated with the message
   */
  _templateId: string;
  /**
   * Environment ID where the message is sent
   */
  _environmentId: string;
  /**
   * Message template ID
   */
  _messageTemplateId: string;
  /**
   * Organization ID associated with the message
   */
  _organizationId: string;
  /**
   * Notification ID associated with the message
   */
  _notificationId: string;
  /**
   * Subscriber ID associated with the message
   */
  _subscriberId: string;
  /**
   * Subscriber details, if available
   */
  subscriber?: SubscriberResponseDto;
  /**
   * Workflow template associated with the message
   */
  template?: WorkflowResponse;
  /**
   * Identifier for the message template
   */
  templateIdentifier?: string;
  /**
   * Creation date of the message
   */
  createdAt: string;
  /**
   * Array of delivery dates for the message, if the message has multiple delivery dates, for example after being snoozed
   */
  deliveredAt?: string[];
  /**
   * Last seen date of the message, if available
   */
  lastSeenDate?: string;
  /**
   * Last read date of the message, if available
   */
  lastReadDate?: string;
  /**
   * Content of the message, can be an email block or a string
   */
  content: EmailBlock[] | string;
  /**
   * Transaction ID associated with the message
   */
  transactionId: string;
  /**
   * Subject of the message, if applicable
   */
  subject?: string;
  /**
   * Channel type through which the message is sent
   */
  channel: "in_app" | "email" | "sms" | "chat" | "push";
  /**
   * Indicates if the message has been read
   */
  read: boolean;
  /**
   * Indicates if the message has been seen
   */
  seen: boolean;
  /**
   * Date when the message will be unsnoozed
   */
  snoozedUntil?: string;
  /**
   * Email address associated with the message, if applicable
   */
  email?: string;
  /**
   * Phone number associated with the message, if applicable
   */
  phone?: string;
  /**
   * Direct webhook URL for the message, if applicable
   */
  directWebhookUrl?: string;
  /**
   * Provider ID associated with the message, if applicable
   */
  providerId?: string;
  /**
   * Device tokens associated with the message, if applicable
   */
  deviceTokens?: string[];
  /**
   * Title of the message, if applicable
   */
  title?: string;
  /**
   * Call to action associated with the message
   */
  cta: MessageCTA;
  /**
   * Feed ID associated with the message, if applicable
   */
  _feedId?: string | null;
  /**
   * Status of the message
   */
  status: "sent" | "error" | "warning";
  /**
   * Error ID if the message has an error
   */
  errorId?: string;
  /**
   * Error text if the message has an error
   */
  errorText?: string;
  /**
   * The payload that was used to send the notification trigger
   */
  payload?: {};
  /**
   * Provider specific overrides used when triggering the notification
   */
  overrides?: {};
}
export interface SubscriberResponseDto {
  /**
   * The internal ID generated by Novu for your subscriber. This ID does not match the `subscriberId` used in your queries. Refer to `subscriberId` for that identifier.
   */
  _id?: string;
  /**
   * The first name of the subscriber.
   */
  firstName?: string;
  /**
   * The last name of the subscriber.
   */
  lastName?: string;
  /**
   * The email address of the subscriber.
   */
  email?: string;
  /**
   * The phone number of the subscriber.
   */
  phone?: string;
  /**
   * The URL of the subscriber's avatar image.
   */
  avatar?: string;
  /**
   * The locale setting of the subscriber, indicating their preferred language or region.
   */
  locale?: string;
  /**
   * An array of channel settings associated with the subscriber.
   */
  channels?: ChannelSettingsDto[];
  /**
   * @deprecated
   * An array of topics that the subscriber is subscribed to.
   */
  topics?: string[];
  /**
   * Indicates whether the subscriber is currently online.
   */
  isOnline?: boolean;
  /**
   * The timestamp indicating when the subscriber was last online, in ISO 8601 format.
   */
  lastOnlineAt?: string;
  /**
   * The version of the subscriber document.
   */
  __v?: number;
  /**
   * Additional custom data for the subscriber
   */
  data?: {
    [k: string]: unknown;
  } | null;
  /**
   * Timezone of the subscriber
   */
  timezone?: string;
  /**
   * The identifier used to create this subscriber, which typically corresponds to the user ID in your system.
   */
  subscriberId: string;
  /**
   * The unique identifier of the organization to which the subscriber belongs.
   */
  _organizationId: string;
  /**
   * The unique identifier of the environment associated with this subscriber.
   */
  _environmentId: string;
  /**
   * Indicates whether the subscriber has been deleted.
   */
  deleted: boolean;
  /**
   * The timestamp indicating when the subscriber was created, in ISO 8601 format.
   */
  createdAt: string;
  /**
   * The timestamp indicating when the subscriber was last updated, in ISO 8601 format.
   */
  updatedAt: string;
}
export interface ChannelSettingsDto {
  /**
   * The provider identifier for the credentials
   */
  providerId:
    | "slack"
    | "discord"
    | "msteams"
    | "mattermost"
    | "ryver"
    | "zulip"
    | "grafana-on-call"
    | "getstream"
    | "rocket-chat"
    | "whatsapp-business"
    | "fcm"
    | "apns"
    | "expo"
    | "one-signal"
    | "pushpad"
    | "push-webhook"
    | "pusher-beams";
  /**
   * The integration identifier
   */
  integrationIdentifier?: string;
  /**
   * Credentials payload for the specified provider
   */
  credentials: ChannelCredentials;
  /**
   * The unique identifier of the integration associated with this channel.
   */
  _integrationId: string;
}
export interface ChannelCredentials {
  /**
   * Webhook URL used by chat app integrations. The webhook should be obtained from the chat app provider.
   */
  webhookUrl?: string;
  /**
   * Channel specification for Mattermost chat notifications.
   */
  channel?: string;
  /**
   * Contains an array of the subscriber device tokens for a given provider. Used on Push integrations.
   */
  deviceTokens?: string[];
  /**
   * Alert UID for Grafana on-call webhook payload.
   */
  alertUid?: string;
  /**
   * Title to be used with Grafana on-call webhook.
   */
  title?: string;
  /**
   * Image URL property for Grafana on-call webhook.
   */
  imageUrl?: string;
  /**
   * State property for Grafana on-call webhook.
   */
  state?: string;
  /**
   * Link to upstream details property for Grafana on-call webhook.
   */
  externalUrl?: string;
}
export interface WorkflowResponse {
  _id?: string;
  name: string;
  description: string;
  active: boolean;
  draft: boolean;
  preferenceSettings: SubscriberPreferenceChannels;
  critical: boolean;
  tags: string[];
  steps: NotificationStepDto[];
  _organizationId: string;
  _creatorId: string;
  _environmentId: string;
  triggers: NotificationTrigger[];
  _notificationGroupId: string;
  _parentId?: string;
  deleted: boolean;
  deletedAt: string;
  deletedBy: string;
  notificationGroup?: NotificationGroup;
  data?: {};
  workflowIntegrationStatus?: {};
}
export interface SubscriberPreferenceChannels {
  /**
   * Email channel preference
   */
  email?: boolean;
  /**
   * SMS channel preference
   */
  sms?: boolean;
  /**
   * In-app channel preference
   */
  in_app?: boolean;
  /**
   * Chat channel preference
   */
  chat?: boolean;
  /**
   * Push notification channel preference
   */
  push?: boolean;
}
export interface NotificationStepDto {
  /**
   * Unique identifier for the notification step.
   */
  _id?: string;
  /**
   * Universally unique identifier for the notification step.
   */
  uuid?: string;
  /**
   * Name of the notification step.
   */
  name?: string;
  /**
   * ID of the template associated with this notification step.
   */
  _templateId?: string;
  /**
   * Indicates whether the notification step is active.
   */
  active?: boolean;
  /**
   * Determines if the process should stop on failure.
   */
  shouldStopOnFail?: boolean;
  /**
   * Message template used in this notification step.
   */
  template?: MessageTemplate;
  /**
   * Filters applied to this notification step.
   */
  filters?: StepFilterDto[];
  /**
   * ID of the parent notification step, if applicable.
   */
  _parentId?: string;
  /**
   * Metadata associated with the workflow step. Can vary based on the type of step.
   */
  metadata?: DigestRegularMetadata | DigestTimedMetadata | DelayRegularMetadata | DelayScheduledMetadata;
  /**
   * Callback information for replies, including whether it is active and the callback URL.
   */
  replyCallback?: ReplyCallback;
  variants?: NotificationStepData[];
}
export interface MessageTemplate {}
export interface StepFilterDto {
  isNegated: boolean;
  type: "BOOLEAN" | "TEXT" | "DATE" | "NUMBER" | "STATEMENT" | "LIST" | "MULTI_LIST" | "GROUP";
  value: "AND" | "OR";
  children: FieldFilterPartDto[];
}
export interface FieldFilterPartDto {
  field: string;
  value: string;
  operator:
    | "LARGER"
    | "SMALLER"
    | "LARGER_EQUAL"
    | "SMALLER_EQUAL"
    | "EQUAL"
    | "NOT_EQUAL"
    | "ALL_IN"
    | "ANY_IN"
    | "NOT_IN"
    | "BETWEEN"
    | "NOT_BETWEEN"
    | "LIKE"
    | "NOT_LIKE"
    | "IN";
  on: "subscriber" | "payload";
}
export interface DigestRegularMetadata {
  amount?: number;
  unit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  digestKey?: string;
  type: "regular" | "backoff";
  backoff?: boolean;
  backoffAmount?: number;
  backoffUnit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  updateMode?: boolean;
}
export interface DigestTimedMetadata {
  amount?: number;
  unit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  digestKey?: string;
  type: "timed";
  timed?: TimedConfig;
}
export interface TimedConfig {
  atTime?: string;
  weekDays?: ("monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday")[];
  monthDays?: string[];
  ordinal?: "1" | "2" | "3" | "4" | "5" | "last";
  ordinalValue?:
    | "day"
    | "weekday"
    | "weekend"
    | "sunday"
    | "monday"
    | "tuesday"
    | "wednesday"
    | "thursday"
    | "friday"
    | "saturday";
  monthlyType?: "each" | "on";
}
export interface DelayRegularMetadata {
  amount?: number;
  unit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  type: "regular";
}
export interface DelayScheduledMetadata {
  type: "scheduled";
  delayPath: string;
}
export interface ReplyCallback {
  /**
   * Indicates whether the reply callback is active.
   */
  active?: boolean;
  /**
   * The URL to which replies should be sent.
   */
  url?: string;
}
export interface NotificationStepData {
  /**
   * Unique identifier for the notification step.
   */
  _id?: string;
  /**
   * Universally unique identifier for the notification step.
   */
  uuid?: string;
  /**
   * Name of the notification step.
   */
  name?: string;
  /**
   * ID of the template associated with this notification step.
   */
  _templateId?: string;
  /**
   * Indicates whether the notification step is active.
   */
  active?: boolean;
  /**
   * Determines if the process should stop on failure.
   */
  shouldStopOnFail?: boolean;
  /**
   * Message template used in this notification step.
   */
  template?: MessageTemplate1;
  /**
   * Filters applied to this notification step.
   */
  filters?: StepFilterDto1[];
  /**
   * ID of the parent notification step, if applicable.
   */
  _parentId?: string;
  /**
   * Metadata associated with the workflow step. Can vary based on the type of step.
   */
  metadata?: DigestRegularMetadata1 | DigestTimedMetadata1 | DelayRegularMetadata1 | DelayScheduledMetadata1;
  /**
   * Callback information for replies, including whether it is active and the callback URL.
   */
  replyCallback?: ReplyCallback1;
}
export interface MessageTemplate1 {}
export interface StepFilterDto1 {
  isNegated: boolean;
  type: "BOOLEAN" | "TEXT" | "DATE" | "NUMBER" | "STATEMENT" | "LIST" | "MULTI_LIST" | "GROUP";
  value: "AND" | "OR";
  children: FieldFilterPartDto[];
}
export interface DigestRegularMetadata1 {
  amount?: number;
  unit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  digestKey?: string;
  type: "regular" | "backoff";
  backoff?: boolean;
  backoffAmount?: number;
  backoffUnit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  updateMode?: boolean;
}
export interface DigestTimedMetadata1 {
  amount?: number;
  unit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  digestKey?: string;
  type: "timed";
  timed?: TimedConfig;
}
export interface DelayRegularMetadata1 {
  amount?: number;
  unit?: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
  type: "regular";
}
export interface DelayScheduledMetadata1 {
  type: "scheduled";
  delayPath: string;
}
export interface ReplyCallback1 {
  /**
   * Indicates whether the reply callback is active.
   */
  active?: boolean;
  /**
   * The URL to which replies should be sent.
   */
  url?: string;
}
export interface NotificationTrigger {
  type: "event";
  identifier: string;
  variables: NotificationTriggerVariable[];
  subscriberVariables?: NotificationTriggerVariable1[];
}
export interface NotificationTriggerVariable {
  /**
   * Name of the variable
   */
  name: string;
}
export interface NotificationTriggerVariable1 {
  /**
   * Name of the variable
   */
  name: string;
}
export interface NotificationGroup {
  _id?: string;
  name: string;
  _environmentId: string;
  _organizationId: string;
  _parentId?: string;
}
export interface EmailBlock {
  /**
   * Type of the email block
   */
  type: "button" | "text";
  /**
   * Content of the email block
   */
  content: string;
  /**
   * URL associated with the email block, if any
   */
  url?: string;
  /**
   * Styles applied to the email block
   */
  styles?: EmailBlockStyles;
}
export interface EmailBlockStyles {
  /**
   * Text alignment for the email block
   */
  textAlign: "center" | "left" | "right";
}
export interface MessageCTA {
  /**
   * Type of call to action
   */
  type?: "redirect";
  /**
   * Data associated with the call to action
   */
  data?: MessageCTAData;
  /**
   * Action associated with the call to action
   */
  action?: MessageAction;
}
export interface MessageCTAData {
  /**
   * URL for the call to action
   */
  url?: string;
}
export interface MessageAction {
  /**
   * Status of the message action
   */
  status?: "pending" | "done";
  /**
   * List of buttons associated with the message action
   */
  buttons?: MessageButton[];
  /**
   * Result of the message action
   */
  result?: MessageActionResult;
}
export interface MessageButton {
  /**
   * Type of button for the action result
   */
  type: "primary" | "secondary";
  /**
   * Content of the button
   */
  content: string;
  /**
   * Content of the result when the button is clicked
   */
  resultContent?: string;
}
export interface MessageActionResult {
  /**
   * Payload of the action result
   */
  payload?: {};
  /**
   * Type of button for the action result
   */
  type?: "primary" | "secondary";
}
 
curl -X GET "https://api.novu.co/v1/messages?channel=in_app&subscriberId=string&transactionId=string&page=0&limit=10" \
  -H "idempotency-key: string" \
  -H "Authorization: <token>"
{
  "totalCount": 0,
  "hasMore": true,
  "data": [
    {
      "_id": "string",
      "_templateId": "string",
      "_environmentId": "string",
      "_messageTemplateId": "string",
      "_organizationId": "string",
      "_notificationId": "string",
      "_subscriberId": "string",
      "subscriber": {
        "_id": "string",
        "firstName": "string",
        "lastName": "string",
        "email": "string",
        "phone": "string",
        "avatar": "string",
        "locale": "string",
        "channels": [
          {
            "providerId": "slack",
            "integrationIdentifier": "string",
            "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"
          }
        ],
        "topics": [
          "string"
        ],
        "isOnline": true,
        "lastOnlineAt": "string",
        "__v": 0,
        "data": {},
        "timezone": "string",
        "subscriberId": "string",
        "_organizationId": "string",
        "_environmentId": "string",
        "deleted": true,
        "createdAt": "string",
        "updatedAt": "string"
      },
      "template": {
        "_id": "string",
        "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,
                "type": "BOOLEAN",
                "value": "AND",
                "children": [
                  {
                    "field": "string",
                    "value": "string",
                    "operator": "LARGER",
                    "on": "subscriber"
                  }
                ]
              }
            ],
            "_parentId": "string",
            "metadata": {
              "amount": 0,
              "unit": "seconds",
              "digestKey": "string",
              "type": "regular",
              "backoff": true,
              "backoffAmount": 0,
              "backoffUnit": "seconds",
              "updateMode": true
            },
            "replyCallback": {
              "active": true,
              "url": "string"
            },
            "variants": [
              {
                "_id": "string",
                "uuid": "string",
                "name": "string",
                "_templateId": "string",
                "active": true,
                "shouldStopOnFail": true,
                "template": {},
                "filters": [
                  {
                    "isNegated": true,
                    "type": "BOOLEAN",
                    "value": "AND",
                    "children": [
                      {
                        "field": "string",
                        "value": "string",
                        "operator": "LARGER",
                        "on": "subscriber"
                      }
                    ]
                  }
                ],
                "_parentId": "string",
                "metadata": {
                  "amount": 0,
                  "unit": "seconds",
                  "digestKey": "string",
                  "type": "regular",
                  "backoff": true,
                  "backoffAmount": 0,
                  "backoffUnit": "seconds",
                  "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",
        "_parentId": "string",
        "deleted": true,
        "deletedAt": "string",
        "deletedBy": "string",
        "notificationGroup": {
          "_id": "string",
          "name": "string",
          "_environmentId": "string",
          "_organizationId": "string",
          "_parentId": "string"
        },
        "data": {},
        "workflowIntegrationStatus": {}
      },
      "templateIdentifier": "string",
      "createdAt": "string",
      "deliveredAt": [
        "string"
      ],
      "lastSeenDate": "string",
      "lastReadDate": "string",
      "content": [
        {
          "type": "button",
          "content": "string",
          "url": "string",
          "styles": {
            "textAlign": "center"
          }
        }
      ],
      "transactionId": "string",
      "subject": "string",
      "channel": "in_app",
      "read": true,
      "seen": true,
      "snoozedUntil": "string",
      "email": "string",
      "phone": "string",
      "directWebhookUrl": "string",
      "providerId": "string",
      "deviceTokens": [
        "string"
      ],
      "title": "string",
      "cta": {
        "type": "redirect",
        "data": {
          "url": "string"
        },
        "action": {
          "status": "pending",
          "buttons": [
            {
              "type": "primary",
              "content": "string",
              "resultContent": "string"
            }
          ],
          "result": {
            "payload": {},
            "type": "primary"
          }
        }
      },
      "_feedId": "string",
      "status": "sent",
      "errorId": "string",
      "errorText": "string",
      "payload": {},
      "overrides": {}
    }
  ],
  "pageSize": 0,
  "page": 0
}