POST
/
v1
/
subscribers
/
{subscriberId}
/
messages
/
{messageId}
/
actions
/
{type}
import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.subscribers.messages.updateAsSeen({
    messageId: "<id>",
    type: "<value>",
    subscriberId: "<id>",
    markMessageActionAsSeenDto: {
      status: "done",
    },
  });

  // Handle the result
  console.log(result);
}

run();
{
  "_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>",
    "subscriberId": "<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>",
    "_organizationId": "<string>",
    "_environmentId": "<string>",
    "deleted": true,
    "createdAt": "<string>",
    "updatedAt": "<string>",
    "__v": 123,
    "data": {},
    "timezone": "<string>"
  },
  "template": {
    "_id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "active": true,
    "draft": true,
    "preferenceSettings": {
      "email": true,
      "sms": true,
      "in_app": true,
      "chat": true,
      "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": 123,
          "unit": "seconds",
          "digestKey": "<string>",
          "type": "regular",
          "backoff": true,
          "backoffAmount": 123,
          "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": 123,
              "unit": "seconds",
              "digestKey": "<string>",
              "type": "regular",
              "backoff": true,
              "backoffAmount": 123,
              "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>",
  "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,
  "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": {}
}

Authorizations

Authorization
string
header
required

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

Headers

idempotency-key
string

A header for idempotency purposes

Path Parameters

messageId
string
required
type
any
required
subscriberId
string
required

Body

application/json
status
enum<string>
required

Message action status

Available options:
pending,
done
payload
object

Message action payload

Response

201
application/json
Created
_templateId
string
required

Template ID associated with the message

_environmentId
string
required

Environment ID where the message is sent

_messageTemplateId
string
required

Message template ID

_organizationId
string
required

Organization ID associated with the message

_notificationId
string
required

Notification ID associated with the message

_subscriberId
string
required

Subscriber ID associated with the message

createdAt
string
required

Creation date of the message

content
required

Content of the message, can be an email block or a string

transactionId
string
required

Transaction ID associated with the message

channel
enum<string>
required

Channel type through which the message is sent

Available options:
in_app,
email,
sms,
chat,
push
read
boolean
required

Indicates if the message has been read

seen
boolean
required

Indicates if the message has been seen

cta
object
required

Call to action associated with the message

status
enum<string>
required

Status of the message

Available options:
sent,
error,
warning
_id
string

Unique identifier for the message

subscriber
object

Subscriber details, if available

template
object

Workflow template associated with the message

templateIdentifier
string

Identifier for the message template

lastSeenDate
string

Last seen date of the message, if available

lastReadDate
string

Last read date of the message, if available

subject
string

Subject of the message, if applicable

email
string

Email address associated with the message, if applicable

phone
string

Phone number associated with the message, if applicable

directWebhookUrl
string

Direct webhook URL for the message, if applicable

providerId
string

Provider ID associated with the message, if applicable

deviceTokens
string[]

Device tokens associated with the message, if applicable

title
string

Title of the message, if applicable

_feedId
string | null

Feed ID associated with the message, if applicable

errorId
string

Error ID if the message has an error

errorText
string

Error text if the message has an error

payload
object

The payload that was used to send the notification trigger

overrides
object

Provider specific overrides used when triggering the notification