SubscribersController_markActionAsSeen
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();curl --request POST \
--url https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"payload": {}
}'import requests
url = "https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}"
payload = { "payload": {} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({payload: {}})
};
fetch('https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}"
payload := strings.NewReader("{\n \"payload\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_body{
"_templateId": "<string>",
"_environmentId": "<string>",
"_messageTemplateId": "<string>",
"_organizationId": "<string>",
"_notificationId": "<string>",
"_subscriberId": "<string>",
"createdAt": "<string>",
"content": {
"type": "text",
"content": "<string>",
"url": "<string>",
"styles": {
"textAlign": "left"
}
},
"transactionId": "<string>",
"channel": "in_app",
"read": true,
"seen": true,
"cta": {
"data": {
"url": "<string>"
},
"type": "redirect",
"action": {
"status": "pending",
"buttons": [
{
"type": "primary",
"content": "<string>",
"resultContent": "<string>"
}
],
"result": {
"payload": {},
"type": "primary"
}
}
},
"status": "sent",
"errorId": "<string>",
"errorText": "<string>",
"payload": {},
"overrides": {},
"_id": "<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": [
{
"providerId": "slack",
"credentials": {
"webhookUrl": "<string>",
"channel": "<string>",
"deviceTokens": [
"<string>"
],
"alertUid": "<string>",
"title": "<string>",
"imageUrl": "<string>",
"state": "<string>",
"externalUrl": "<string>"
},
"_integrationId": "<string>",
"integrationIdentifier": "<string>"
}
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123
},
"template": {
"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": {
"type": "regular",
"amount": 123,
"unit": "seconds",
"digestKey": "<string>",
"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": {
"type": "regular",
"amount": 123,
"unit": "seconds",
"digestKey": "<string>",
"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>",
"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>",
"lastSeenDate": "<string>",
"lastReadDate": "<string>",
"subject": "<string>",
"email": "<string>",
"phone": "<string>",
"directWebhookUrl": "<string>",
"providerId": "<string>",
"deviceTokens": [
"<string>"
],
"title": "<string>",
"_feedId": "<string>"
}"Request with key 3909d656-d4fe-4e80-ba86-90d3861afcd7 is currently being processed. Please retry after 1 second""API rate limit exceeded""Please wait some time, then try again."Subscribers
Update notification action status
This API is deprecated, use v2 API instead. Update in-app notification’s action status by its unique key identifier messageId and type field type. type field can be primary or secondary
POST
/
v1
/
subscribers
/
{subscriberId}
/
messages
/
{messageId}
/
actions
/
{type}
SubscribersController_markActionAsSeen
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();curl --request POST \
--url https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"payload": {}
}'import requests
url = "https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}"
payload = { "payload": {} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({payload: {}})
};
fetch('https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}"
payload := strings.NewReader("{\n \"payload\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_body{
"_templateId": "<string>",
"_environmentId": "<string>",
"_messageTemplateId": "<string>",
"_organizationId": "<string>",
"_notificationId": "<string>",
"_subscriberId": "<string>",
"createdAt": "<string>",
"content": {
"type": "text",
"content": "<string>",
"url": "<string>",
"styles": {
"textAlign": "left"
}
},
"transactionId": "<string>",
"channel": "in_app",
"read": true,
"seen": true,
"cta": {
"data": {
"url": "<string>"
},
"type": "redirect",
"action": {
"status": "pending",
"buttons": [
{
"type": "primary",
"content": "<string>",
"resultContent": "<string>"
}
],
"result": {
"payload": {},
"type": "primary"
}
}
},
"status": "sent",
"errorId": "<string>",
"errorText": "<string>",
"payload": {},
"overrides": {},
"_id": "<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": [
{
"providerId": "slack",
"credentials": {
"webhookUrl": "<string>",
"channel": "<string>",
"deviceTokens": [
"<string>"
],
"alertUid": "<string>",
"title": "<string>",
"imageUrl": "<string>",
"state": "<string>",
"externalUrl": "<string>"
},
"_integrationId": "<string>",
"integrationIdentifier": "<string>"
}
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123
},
"template": {
"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": {
"type": "regular",
"amount": 123,
"unit": "seconds",
"digestKey": "<string>",
"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": {
"type": "regular",
"amount": 123,
"unit": "seconds",
"digestKey": "<string>",
"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>",
"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>",
"lastSeenDate": "<string>",
"lastReadDate": "<string>",
"subject": "<string>",
"email": "<string>",
"phone": "<string>",
"directWebhookUrl": "<string>",
"providerId": "<string>",
"deviceTokens": [
"<string>"
],
"title": "<string>",
"_feedId": "<string>"
}"Request with key 3909d656-d4fe-4e80-ba86-90d3861afcd7 is currently being processed. Please retry after 1 second""API rate limit exceeded""Please wait some time, then try again."Enter your API key in the
Authorization field like the example shown below:E.g ApiKey 18d2e625f05d80eAuthorizations
Body
application/json
Response
Created
Was this page helpful?