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

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.subscribers.messages.updateAsSeen({
    messageId: "<value>",
    type: "<value>",
    subscriberId: "<value>",
    markMessageActionAsSeenDto: {
      status: MarkMessageActionAsSeenDtoStatus.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": "<string>",
          "channel": "<string>",
          "deviceTokens": [
            "<string>"
          ],
          "alertUid": "<string>",
          "title": "<string>",
          "imageUrl": "<string>",
          "state": "<string>",
          "externalUrl": "<string>"
        },
        "_integrationId": "<string>"
      }
    ],
    "isOnline": true,
    "lastOnlineAt": "<string>",
    "_organizationId": "<string>",
    "_environmentId": "<string>",
    "deleted": true,
    "createdAt": "<string>",
    "updatedAt": "<string>",
    "__v": 123
  },
  "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": {},
        "metadata": {
          "amount": 123,
          "unit": "seconds",
          "digestKey": "<string>",
          "type": "regular",
          "backoff": true,
          "backoffAmount": 123,
          "backoffUnit": "seconds",
          "updateMode": true
        },
        "replyCallback": {},
        "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": {},
          "metadata": {
            "amount": 123,
            "unit": "seconds",
            "digestKey": "<string>",
            "type": "regular",
            "backoff": true,
            "backoffAmount": 123,
            "backoffUnit": "seconds",
            "updateMode": true
          },
          "replyCallback": {}
        }
      }
    ],
    "_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": "text",
    "content": "<string>",
    "url": "<string>",
    "styles": {
      "textAlign": "left"
    }
  },
  "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": {}
}

Enter your API key in the Authorization field like the example shown below:

E.g ApiKey 18d2e625f05d80e

Authorizations

Authorization
string
header
required

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

Path Parameters

messageId
string
required
type
string
required
subscriberId
string
required

Body

application/json

Response

201
application/json

Created

The response is of type object.