Generate a step preview
Generates a preview for a specific workflow step by its unique identifier stepId
Authorization
Authorization<token>API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".
In: header
Request Body
application/jsonRequiredPreview generation details
controlValuesobjectOptional control values
previewPayloadobjectOptional payload for preview generation
Path Parameters
workflowIdRequiredstringstepIdRequiredstringHeader Parameters
idempotency-keystringA header for idempotency purposes
Response Body
Created
previewPayloadExampleRequiredobjectPreview payload example
schemaobject | nullThe payload schema that was used to generate the preview payload example
novuSignaturestringSample novu-signature header value for HTTP request steps
resultRequiredobject | object | object | object | object | object | object | object | objectPreview result
export interface Response {
/**
* Preview payload example
*/
previewPayloadExample: PreviewPayloadDto;
/**
* The payload schema that was used to generate the preview payload example
*/
schema?: {
[k: string]: unknown;
} | null;
/**
* Sample novu-signature header value for HTTP request steps
*/
novuSignature?: string;
/**
* Preview result
*/
result:
| {
[k: string]: unknown;
}
| {
type?: "email";
preview?: EmailRenderOutput;
error?: PreviewErrorDto;
}
| {
type?: "email";
preview?: EmailRenderOutput1;
error?: PreviewErrorDto1;
}
| {
type?: "in_app";
preview?: InAppRenderOutput;
error?: PreviewErrorDto2;
}
| {
type?: "sms";
preview?: SmsRenderOutput;
error?: PreviewErrorDto3;
}
| {
type?: "push";
preview?: PushRenderOutput;
error?: PreviewErrorDto4;
}
| {
type?: "chat";
preview?: ChatRenderOutput;
error?: PreviewErrorDto5;
}
| {
type?: "delay";
preview?: DigestRegularOutput;
}
| {
type?: "digest";
preview?: DigestRegularOutput1;
};
}
export interface PreviewPayloadDto {
/**
* Partial subscriber information
*/
subscriber?: SubscriberResponseDtoOptional;
/**
* Payload data
*/
payload?: {
[k: string]: unknown;
};
/**
* Steps data
*/
steps?: {
[k: string]: unknown;
};
context?: {
[k: string]:
| string
| {
id: string;
/**
* Optional additional context data
*/
data?: {
[k: string]: unknown;
};
};
};
/**
* Environment variables data
*/
env?: {
[k: string]: unknown;
};
}
export interface SubscriberResponseDtoOptional {
/**
* 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 | null;
/**
* The last name of the subscriber.
*/
lastName?: string | null;
/**
* The email address of the subscriber.
*/
email?: string | null;
/**
* The phone number of the subscriber.
*/
phone?: string | null;
/**
* The URL of the subscriber's avatar image.
*/
avatar?: string | null;
/**
* The locale setting of the subscriber, indicating their preferred language or region.
*/
locale?: string | null;
/**
* 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 | null;
/**
* The timestamp indicating when the subscriber was last online, in ISO 8601 format.
*/
lastOnlineAt?: string | null;
/**
* 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 | null;
}
export interface ChannelSettingsDto {
/**
* The provider identifier for the credentials
*/
providerId:
| "slack"
| "discord"
| "msteams"
| "mattermost"
| "ryver"
| "zulip"
| "grafana-on-call"
| "getstream"
| "rocket-chat"
| "whatsapp-business"
| "chat-webhook"
| "novu-slack"
| "fcm"
| "apns"
| "expo"
| "one-signal"
| "pushpad"
| "push-webhook"
| "pusher-beams"
| "appio";
/**
* 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 EmailRenderOutput {
/**
* Subject of the email
*/
subject: string;
/**
* Body of the email
*/
body: string;
}
export interface PreviewErrorDto {
/**
* Short error title
*/
title: string;
/**
* Detailed error message
*/
message: string;
/**
* Actionable hint for the user
*/
hint: string;
}
export interface EmailRenderOutput1 {
/**
* Subject of the email
*/
subject: string;
/**
* Body of the email
*/
body: string;
}
export interface PreviewErrorDto1 {
/**
* Short error title
*/
title: string;
/**
* Detailed error message
*/
message: string;
/**
* Actionable hint for the user
*/
hint: string;
}
export interface InAppRenderOutput {
/**
* Subject of the in-app notification
*/
subject?: string;
/**
* Body of the in-app notification
*/
body: string;
/**
* Avatar for the in-app notification
*/
avatar?: string;
/**
* Primary action details
*/
primaryAction?: ActionDto;
/**
* Secondary action details
*/
secondaryAction?: ActionDto1;
/**
* Additional data
*/
data?: {
[k: string]: unknown;
};
/**
* Redirect details
*/
redirect?: RedirectDto1;
}
export interface ActionDto {
/**
* Label for the action button.
*/
label?: string;
/**
* Redirect configuration for the action.
*/
redirect?: RedirectDto;
}
export interface RedirectDto {
/**
* URL to redirect to
*/
url: string;
/**
* Target attribute for the redirect link
*/
target?: "_self" | "_blank" | "_parent" | "_top" | "_unfencedTop";
}
export interface ActionDto1 {
/**
* Label for the action button.
*/
label?: string;
/**
* Redirect configuration for the action.
*/
redirect?: RedirectDto;
}
export interface RedirectDto1 {
/**
* URL to redirect to
*/
url: string;
/**
* Target attribute for the redirect link
*/
target?: "_self" | "_blank" | "_parent" | "_top" | "_unfencedTop";
}
export interface PreviewErrorDto2 {
/**
* Short error title
*/
title: string;
/**
* Detailed error message
*/
message: string;
/**
* Actionable hint for the user
*/
hint: string;
}
export interface SmsRenderOutput {
/**
* Body of the SMS message
*/
body: string;
}
export interface PreviewErrorDto3 {
/**
* Short error title
*/
title: string;
/**
* Detailed error message
*/
message: string;
/**
* Actionable hint for the user
*/
hint: string;
}
export interface PushRenderOutput {
/**
* Subject of the push notification
*/
subject: string;
/**
* Body of the push notification
*/
body: string;
}
export interface PreviewErrorDto4 {
/**
* Short error title
*/
title: string;
/**
* Detailed error message
*/
message: string;
/**
* Actionable hint for the user
*/
hint: string;
}
export interface ChatRenderOutput {
/**
* Body of the chat message
*/
body: string;
}
export interface PreviewErrorDto5 {
/**
* Short error title
*/
title: string;
/**
* Detailed error message
*/
message: string;
/**
* Actionable hint for the user
*/
hint: string;
}
export interface DigestRegularOutput {
/**
* Amount of time units
*/
amount: number;
/**
* Time unit
*/
unit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
/**
* Optional digest key
*/
digestKey?: string;
/**
* Look back window configuration
*/
lookBackWindow?: {};
}
export interface DigestRegularOutput1 {
/**
* Amount of time units
*/
amount: number;
/**
* Time unit
*/
unit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
/**
* Optional digest key
*/
digestKey?: string;
/**
* Look back window configuration
*/
lookBackWindow?: {};
}
curl -X POST "https://api.novu.co/v2/workflows/string/step/string/preview" \
-H "idempotency-key: string" \
-H "Authorization: <token>" \
-H "Content-Type: application/json" \
-d '{
"controlValues": {},
"previewPayload": {
"subscriber": {
"_id": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"avatar": "string",
"locale": "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",
"__v": 0,
"data": {},
"timezone": "string"
},
"payload": {},
"steps": {},
"context": {
"property1": "org-acme",
"property2": "org-acme"
},
"env": {}
}
}'{
"previewPayloadExample": {
"subscriber": {
"_id": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"avatar": "string",
"locale": "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",
"__v": 0,
"data": {},
"timezone": "string"
},
"payload": {},
"steps": {},
"context": {
"property1": "org-acme",
"property2": "org-acme"
},
"env": {}
},
"schema": {},
"novuSignature": "string",
"result": {}
}