Layouts
Generate layout preview
Generates a preview for a layout by its unique identifier layoutId
POST
/
v2
/
layouts
/
{layoutId}
/
preview
TypeScript
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.layouts.generatePreview({
previewPayload: {
subscriber: {
channels: [
{
providerId: "mattermost",
integrationIdentifier: "<value>",
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: "<id>",
},
],
},
},
}, "<id>");
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Layouts.GeneratePreviewAsync(
layoutId: "<id>",
layoutPreviewRequestDto: new LayoutPreviewRequestDto() {
PreviewPayload = new LayoutPreviewPayloadDto() {
Subscriber = new SubscriberResponseDtoOptional() {
Channels = new List<ChannelSettingsDto>() {
new ChannelSettingsDto() {
ProviderId = ChatOrPushProviderEnum.Mattermost,
Credentials = new ChannelCredentials() {
WebhookUrl = "https://example.com/webhook",
Channel = "general",
DeviceTokens = new List<string>() {
"token1",
"token2",
"token3",
},
AlertUid = "12345-abcde",
Title = "Critical Alert",
ImageUrl = "https://example.com/image.png",
State = "resolved",
ExternalUrl = "https://example.com/details",
},
IntegrationId = "<id>",
},
},
},
},
}
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$layoutPreviewRequestDto = new Components\LayoutPreviewRequestDto(
previewPayload: new Components\LayoutPreviewPayloadDto(
subscriber: new Components\SubscriberResponseDtoOptional(
channels: [
new Components\ChannelSettingsDto(
providerId: Components\ChatOrPushProviderEnum::Mattermost,
credentials: new Components\ChannelCredentials(
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: '<id>',
),
],
),
),
);
$response = $sdk->layouts->generatePreview(
layoutId: '<id>',
layoutPreviewRequestDto: $layoutPreviewRequestDto
);
if ($response->generateLayoutPreviewResponseDto !== null) {
// handle response
}import novu_py
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.layouts.generate_preview(layout_id="<id>", layout_preview_request_dto={
"preview_payload": {
"subscriber": {
"channels": [
{
"provider_id": novu_py.ChatOrPushProviderEnum.MATTERMOST,
"credentials": {
"webhook_url": "https://example.com/webhook",
"channel": "general",
"device_tokens": [
"token1",
"token2",
"token3",
],
"alert_uid": "12345-abcde",
"title": "Critical Alert",
"image_url": "https://example.com/image.png",
"state": "resolved",
"external_url": "https://example.com/details",
},
"integration_id": "<id>",
},
],
},
},
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Layouts.GeneratePreview(ctx, "<id>", components.LayoutPreviewRequestDto{
PreviewPayload: &components.LayoutPreviewPayloadDto{
Subscriber: &components.SubscriberResponseDtoOptional{
Channels: []components.ChannelSettingsDto{
components.ChannelSettingsDto{
ProviderID: components.ChatOrPushProviderEnumMattermost,
Credentials: components.ChannelCredentials{
WebhookURL: v3.Pointer("https://example.com/webhook"),
Channel: v3.Pointer("general"),
DeviceTokens: []string{
"token1",
"token2",
"token3",
},
AlertUID: v3.Pointer("12345-abcde"),
Title: v3.Pointer("Critical Alert"),
ImageURL: v3.Pointer("https://example.com/image.png"),
State: v3.Pointer("resolved"),
ExternalURL: v3.Pointer("https://example.com/details"),
},
IntegrationID: "<id>",
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.GenerateLayoutPreviewResponseDto != nil {
switch res.GenerateLayoutPreviewResponseDto.Result.Type {
case components.ResultUnionTypeOne:
// res.GenerateLayoutPreviewResponseDto.Result.One is populated
}
}
}curl --request POST \
--url https://api.novu.co/v2/layouts/{layoutId}/preview \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"controlValues": {},
"previewPayload": {
"subscriber": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"channels": [
{
"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>",
"integrationIdentifier": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
controlValues: {},
previewPayload: {
subscriber: {
_id: '<string>',
firstName: '<string>',
lastName: '<string>',
email: '<string>',
phone: '<string>',
avatar: '<string>',
locale: '<string>',
channels: [
{
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>',
integrationIdentifier: '<string>'
}
],
topics: ['<string>'],
isOnline: true,
lastOnlineAt: '<string>',
__v: 123,
data: {},
timezone: '<string>'
}
}
})
};
fetch('https://api.novu.co/v2/layouts/{layoutId}/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.novu.co/v2/layouts/{layoutId}/preview")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"controlValues\": {},\n \"previewPayload\": {\n \"subscriber\": {\n \"_id\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"avatar\": \"<string>\",\n \"locale\": \"<string>\",\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"channel\": \"general\",\n \"deviceTokens\": [\n \"token1\",\n \"token2\",\n \"token3\"\n ],\n \"alertUid\": \"12345-abcde\",\n \"title\": \"Critical Alert\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"state\": \"resolved\",\n \"externalUrl\": \"https://example.com/details\"\n },\n \"_integrationId\": \"<string>\",\n \"integrationIdentifier\": \"<string>\"\n }\n ],\n \"topics\": [\n \"<string>\"\n ],\n \"isOnline\": true,\n \"lastOnlineAt\": \"<string>\",\n \"__v\": 123,\n \"data\": {},\n \"timezone\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v2/layouts/{layoutId}/preview")
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 \"controlValues\": {},\n \"previewPayload\": {\n \"subscriber\": {\n \"_id\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"avatar\": \"<string>\",\n \"locale\": \"<string>\",\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"channel\": \"general\",\n \"deviceTokens\": [\n \"token1\",\n \"token2\",\n \"token3\"\n ],\n \"alertUid\": \"12345-abcde\",\n \"title\": \"Critical Alert\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"state\": \"resolved\",\n \"externalUrl\": \"https://example.com/details\"\n },\n \"_integrationId\": \"<string>\",\n \"integrationIdentifier\": \"<string>\"\n }\n ],\n \"topics\": [\n \"<string>\"\n ],\n \"isOnline\": true,\n \"lastOnlineAt\": \"<string>\",\n \"__v\": 123,\n \"data\": {},\n \"timezone\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"previewPayloadExample": {
"subscriber": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"channels": [
{
"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>",
"integrationIdentifier": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
}
},
"result": {
"type": "email",
"preview": {
"body": "<string>"
}
},
"schema": {}
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."Authorizations
API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".
Headers
A header for idempotency purposes
Path Parameters
Body
application/json
Layout preview generation details
Was this page helpful?
⌘I
TypeScript
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.layouts.generatePreview({
previewPayload: {
subscriber: {
channels: [
{
providerId: "mattermost",
integrationIdentifier: "<value>",
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: "<id>",
},
],
},
},
}, "<id>");
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Layouts.GeneratePreviewAsync(
layoutId: "<id>",
layoutPreviewRequestDto: new LayoutPreviewRequestDto() {
PreviewPayload = new LayoutPreviewPayloadDto() {
Subscriber = new SubscriberResponseDtoOptional() {
Channels = new List<ChannelSettingsDto>() {
new ChannelSettingsDto() {
ProviderId = ChatOrPushProviderEnum.Mattermost,
Credentials = new ChannelCredentials() {
WebhookUrl = "https://example.com/webhook",
Channel = "general",
DeviceTokens = new List<string>() {
"token1",
"token2",
"token3",
},
AlertUid = "12345-abcde",
Title = "Critical Alert",
ImageUrl = "https://example.com/image.png",
State = "resolved",
ExternalUrl = "https://example.com/details",
},
IntegrationId = "<id>",
},
},
},
},
}
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$layoutPreviewRequestDto = new Components\LayoutPreviewRequestDto(
previewPayload: new Components\LayoutPreviewPayloadDto(
subscriber: new Components\SubscriberResponseDtoOptional(
channels: [
new Components\ChannelSettingsDto(
providerId: Components\ChatOrPushProviderEnum::Mattermost,
credentials: new Components\ChannelCredentials(
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: '<id>',
),
],
),
),
);
$response = $sdk->layouts->generatePreview(
layoutId: '<id>',
layoutPreviewRequestDto: $layoutPreviewRequestDto
);
if ($response->generateLayoutPreviewResponseDto !== null) {
// handle response
}import novu_py
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.layouts.generate_preview(layout_id="<id>", layout_preview_request_dto={
"preview_payload": {
"subscriber": {
"channels": [
{
"provider_id": novu_py.ChatOrPushProviderEnum.MATTERMOST,
"credentials": {
"webhook_url": "https://example.com/webhook",
"channel": "general",
"device_tokens": [
"token1",
"token2",
"token3",
],
"alert_uid": "12345-abcde",
"title": "Critical Alert",
"image_url": "https://example.com/image.png",
"state": "resolved",
"external_url": "https://example.com/details",
},
"integration_id": "<id>",
},
],
},
},
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Layouts.GeneratePreview(ctx, "<id>", components.LayoutPreviewRequestDto{
PreviewPayload: &components.LayoutPreviewPayloadDto{
Subscriber: &components.SubscriberResponseDtoOptional{
Channels: []components.ChannelSettingsDto{
components.ChannelSettingsDto{
ProviderID: components.ChatOrPushProviderEnumMattermost,
Credentials: components.ChannelCredentials{
WebhookURL: v3.Pointer("https://example.com/webhook"),
Channel: v3.Pointer("general"),
DeviceTokens: []string{
"token1",
"token2",
"token3",
},
AlertUID: v3.Pointer("12345-abcde"),
Title: v3.Pointer("Critical Alert"),
ImageURL: v3.Pointer("https://example.com/image.png"),
State: v3.Pointer("resolved"),
ExternalURL: v3.Pointer("https://example.com/details"),
},
IntegrationID: "<id>",
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.GenerateLayoutPreviewResponseDto != nil {
switch res.GenerateLayoutPreviewResponseDto.Result.Type {
case components.ResultUnionTypeOne:
// res.GenerateLayoutPreviewResponseDto.Result.One is populated
}
}
}curl --request POST \
--url https://api.novu.co/v2/layouts/{layoutId}/preview \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"controlValues": {},
"previewPayload": {
"subscriber": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"channels": [
{
"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>",
"integrationIdentifier": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
controlValues: {},
previewPayload: {
subscriber: {
_id: '<string>',
firstName: '<string>',
lastName: '<string>',
email: '<string>',
phone: '<string>',
avatar: '<string>',
locale: '<string>',
channels: [
{
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>',
integrationIdentifier: '<string>'
}
],
topics: ['<string>'],
isOnline: true,
lastOnlineAt: '<string>',
__v: 123,
data: {},
timezone: '<string>'
}
}
})
};
fetch('https://api.novu.co/v2/layouts/{layoutId}/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.novu.co/v2/layouts/{layoutId}/preview")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"controlValues\": {},\n \"previewPayload\": {\n \"subscriber\": {\n \"_id\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"avatar\": \"<string>\",\n \"locale\": \"<string>\",\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"channel\": \"general\",\n \"deviceTokens\": [\n \"token1\",\n \"token2\",\n \"token3\"\n ],\n \"alertUid\": \"12345-abcde\",\n \"title\": \"Critical Alert\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"state\": \"resolved\",\n \"externalUrl\": \"https://example.com/details\"\n },\n \"_integrationId\": \"<string>\",\n \"integrationIdentifier\": \"<string>\"\n }\n ],\n \"topics\": [\n \"<string>\"\n ],\n \"isOnline\": true,\n \"lastOnlineAt\": \"<string>\",\n \"__v\": 123,\n \"data\": {},\n \"timezone\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v2/layouts/{layoutId}/preview")
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 \"controlValues\": {},\n \"previewPayload\": {\n \"subscriber\": {\n \"_id\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"avatar\": \"<string>\",\n \"locale\": \"<string>\",\n \"channels\": [\n {\n \"credentials\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"channel\": \"general\",\n \"deviceTokens\": [\n \"token1\",\n \"token2\",\n \"token3\"\n ],\n \"alertUid\": \"12345-abcde\",\n \"title\": \"Critical Alert\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"state\": \"resolved\",\n \"externalUrl\": \"https://example.com/details\"\n },\n \"_integrationId\": \"<string>\",\n \"integrationIdentifier\": \"<string>\"\n }\n ],\n \"topics\": [\n \"<string>\"\n ],\n \"isOnline\": true,\n \"lastOnlineAt\": \"<string>\",\n \"__v\": 123,\n \"data\": {},\n \"timezone\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"previewPayloadExample": {
"subscriber": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"avatar": "<string>",
"locale": "<string>",
"channels": [
{
"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>",
"integrationIdentifier": "<string>"
}
],
"topics": [
"<string>"
],
"isOnline": true,
"lastOnlineAt": "<string>",
"__v": 123,
"data": {},
"timezone": "<string>"
}
},
"result": {
"type": "email",
"preview": {
"body": "<string>"
}
},
"schema": {}
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."