Mark a subscriber messages as seen, read, unseen or unread
Authorization
Authorization
<token>API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".
In: header
Request Body
application/json
RequiredmessageId
Requiredstring | array<string>markAs
RequiredstringValue in:
"read" | "seen" | "unread" | "unseen"
Path Parameters
subscriberId
RequiredstringHeader Parameters
idempotency-key
stringA header for idempotency purposes
Response Body
Created
response
Requiredarray<object>export type Response = MessageResponseDto[];
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;
/**
* 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;
/**
* 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 | null;
/**
* 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;
/**
* The identifier used to create this subscriber, which typically corresponds to the user ID in your system.
*/
subscriberId: 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 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;
/**
* 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;
}
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: PreferenceChannels;
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 PreferenceChannels {
email?: boolean;
sms?: boolean;
in_app?: boolean;
chat?: boolean;
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";
/**
* @minItems 0
*
* @minItems 0
*/
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";
/**
* @minItems 0
*
* @minItems 0
*/
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 POST "https://api.novu.co/v1/subscribers/string/messages/mark-as" \
-H "idempotency-key: string" \
-H "Authorization: <token>" \
-H "Content-Type: application/json" \
-d '{
"messageId": "string",
"markAs": "read"
}'
[
{
"_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": 0,
"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": 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",
"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": {}
}
]