> ## Documentation index
> Fetch the complete documentation index at: https://novu.docs7.io/llms.txt
> Ask it with GET https://novu.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.

# Generate a step preview

> Generates a preview for a specific workflow step by its unique identifier **stepId**

`POST /v2/workflows/{workflowId}/step/{stepId}/preview`

## OpenAPI

````yaml https://spec.speakeasy.com/novu/novu/json-development-with-code-samples post /v2/workflows/{workflowId}/step/{stepId}/preview
openapi: 3.0.0
info:
  title: Novu API
  description: Novu REST API. Please see https://docs.novu.co/api-reference for
    more details.
  version: 3.19.2
  contact:
    name: Novu Support
    url: https://discord.gg/novu
    email: support@novu.co
  termsOfService: https://novu.co/terms
  license:
    name: MIT
    url: https://opensource.org/license/mit
servers:
  - url: https://api.novu.co
  - url: https://eu.api.novu.co
security:
  - secretKey: []
tags:
  - name: Events
    description: Events represent a change in state of a subscriber. They are used
      to trigger workflows, and enable you to send notifications to subscribers
      based on their actions.
    externalDocs:
      url: https://docs.novu.co/workflows
  - name: Subscribers
    description: A subscriber in Novu represents someone who should receive a
      message. A subscriber's profile information contains important attributes
      about the subscriber that will be used in messages (name, email). The
      subscriber object can contain other key-value pairs that can be used to
      further personalize your messages.
    externalDocs:
      url: https://docs.novu.co/subscribers/subscribers
  - name: Topics
    description: Topics are a way to group subscribers together so that they can be
      notified of events at once. A topic is identified by a custom key. This
      can be helpful for things like sending out marketing emails or notifying
      users of new features. Topics can also be used to send notifications to
      the subscribers who have been grouped together based on their interests,
      location, activities and much more.
    externalDocs:
      url: https://docs.novu.co/subscribers/topics
  - name: Integrations
    description: With the help of the Integration Store, you can easily integrate
      your favorite delivery provider. During the runtime of the API, the
      Integrations Store is responsible for storing the configurations of all
      the providers.
    externalDocs:
      url: https://docs.novu.co/platform/integrations/overview
  - name: Workflows
    description: All notifications are sent via a workflow. Each workflow acts as a
      container for the logic and blueprint that are associated with a type of
      notification in your system.
    externalDocs:
      url: https://docs.novu.co/workflows
  - name: Messages
    description: A message in Novu represents a notification delivered to a
      recipient on a particular channel. Messages contain information about the
      request that triggered its delivery, a view of the data sent to the
      recipient, and a timeline of its lifecycle events. Learn more about
      messages.
    externalDocs:
      url: https://docs.novu.co/workflows/messages
  - name: Environments
    description: Environments allow you to manage different stages of your
      application development lifecycle. Each environment has its own set of API
      keys and configurations, enabling you to separate development, staging,
      and production workflows.
    externalDocs:
      url: https://docs.novu.co/platform/environments
  - name: Layouts
    description: Layouts are reusable wrappers for your email notifications.
    externalDocs:
      url: https://docs.novu.co/platform/workflow/layouts
  - name: Translations
    description: Used to localize your notifications to different languages.
    externalDocs:
      url: https://docs.novu.co/platform/workflow/advanced-features/translations
  - name: Domains
    description: Used to manage your inbound email domains.
    externalDocs:
      url: https://docs.novu.co/platform/domains
  - name: Agents
    description: Agents are conversational assistants that receive inbound messages
      from connected channels and respond through a custom code bridge or a
      managed runtime provider.
    externalDocs:
      url: https://docs.novu.co/agents
paths:
  /v2/workflows/{workflowId}/step/{stepId}/preview:
    post:
      description: Generates a preview for a specific workflow step by its unique
        identifier **stepId**
      operationId: WorkflowController_generatePreview
      parameters:
        - name: workflowId
          required: true
          in: path
          schema:
            type: string
        - name: stepId
          required: true
          in: path
          schema:
            type: string
        - name: idempotency-key
          in: header
          description: A header for idempotency purposes
          required: false
          schema:
            type: string
      requestBody:
        required: true
        description: Preview generation details
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GeneratePreviewRequestDto"
      responses:
        "201":
          description: Created
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GeneratePreviewResponseDto"
        "400":
          description: Bad Request
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "401":
          description: Unauthorized
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "403":
          description: Forbidden
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "404":
          description: Not Found
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "405":
          description: Method Not Allowed
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "409":
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          description: Conflict
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "413":
          description: Payload Too Large
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "414":
          description: URI Too Long
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "415":
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "422":
          description: Unprocessable Entity
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ValidationErrorDto"
        "429":
          description: "The client has sent too many requests in a given amount of time. "
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
            Retry-After:
              $ref: "#/components/headers/Retry-After"
          content:
            application/json:
              schema:
                type: string
                example: API rate limit exceeded
        "500":
          description: Internal Server Error
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "503":
          description: The server is currently unable to handle the request due to a
            temporary overload or scheduled maintenance, which will likely be
            alleviated after some delay.
          headers:
            Content-Type:
              $ref: "#/components/headers/Content-Type"
            RateLimit-Limit:
              $ref: "#/components/headers/RateLimit-Limit"
            RateLimit-Remaining:
              $ref: "#/components/headers/RateLimit-Remaining"
            RateLimit-Reset:
              $ref: "#/components/headers/RateLimit-Reset"
            RateLimit-Policy:
              $ref: "#/components/headers/RateLimit-Policy"
            Idempotency-Key:
              $ref: "#/components/headers/Idempotency-Key"
            Idempotency-Replay:
              $ref: "#/components/headers/Idempotency-Replay"
            Retry-After:
              $ref: "#/components/headers/Retry-After"
          content:
            application/json:
              schema:
                type: string
                example: Please wait some time, then try again.
      security:
        - secretKey: []
      summary: Generate a step preview
      tags:
        - Workflows
      x-speakeasy-group: Workflows.Steps
      x-speakeasy-name-override: generatePreview
      x-codeSamples:
        - lang: php
          label: PHP
          source: >-
            declare(strict_types=1);


            require 'vendor/autoload.php';


            use novu;

            use novu\Models\Components;


            $sdk = novu\Novu::builder()
                ->setSecurity(
                    'YOUR_SECRET_KEY_HERE'
                )
                ->build();

            $generatePreviewRequestDto = new
            Components\GeneratePreviewRequestDto(
                previewPayload: new Components\PreviewPayloadDto(
                    subscriber: new Components\SubscriberResponseDtoOptional(
                        channels: [
                            new Components\ChannelSettingsDto(
                                providerId: Components\ChatOrPushProviderEnum::NovuSlack,
                                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>',
                            ),
                        ],
                    ),
                    actor: new Components\SubscriberResponseDtoOptional(
                        channels: [
                            new Components\ChannelSettingsDto(
                                providerId: Components\ChatOrPushProviderEnum::Telegram,
                                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>',
                            ),
                        ],
                    ),
                    context: [
                        'key' => 'org-acme',
                    ],
                ),
            );


            $response = $sdk->workflows->steps->generatePreview(
                workflowId: '<id>',
                stepId: '<id>',
                generatePreviewRequestDto: $generatePreviewRequestDto

            );


            if ($response->generatePreviewResponseDto !== null) {
                // handle response
            }
        - lang: python
          label: Python
          source: >-
            import novu_py

            from novu_py import Novu



            with Novu(
                secret_key="YOUR_SECRET_KEY_HERE",
            ) as novu:

                res = novu.workflows.steps.generate_preview(workflow_id="<id>", step_id="<id>", generate_preview_request_dto=novu_py.GeneratePreviewRequestDto(
                    preview_payload=novu_py.PreviewPayloadDto(
                        subscriber=novu_py.SubscriberResponseDtoOptional(
                            channels=[
                                novu_py.ChannelSettingsDto(
                                    provider_id=novu_py.ChatOrPushProviderEnum.NOVU_SLACK,
                                    credentials=novu_py.ChannelCredentials(
                                        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>",
                                ),
                            ],
                        ),
                        actor=novu_py.SubscriberResponseDtoOptional(
                            channels=[
                                novu_py.ChannelSettingsDto(
                                    provider_id=novu_py.ChatOrPushProviderEnum.TELEGRAM,
                                    credentials=novu_py.ChannelCredentials(
                                        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>",
                                ),
                            ],
                        ),
                        context={
                            "key": "org-acme",
                        },
                    ),
                ))

                # Handle response
                print(res)
        - lang: go
          label: Go
          source: >-
            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.Workflows.Steps.GeneratePreview(ctx, "<id>", "<id>", components.GeneratePreviewRequestDto{
                    PreviewPayload: &components.PreviewPayloadDto{
                        Subscriber: &components.SubscriberResponseDtoOptional{
                            Channels: []components.ChannelSettingsDto{
                                components.ChannelSettingsDto{
                                    ProviderID: components.ChatOrPushProviderEnumNovuSlack,
                                    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>",
                                },
                            },
                        },
                        Actor: &components.SubscriberResponseDtoOptional{
                            Channels: []components.ChannelSettingsDto{
                                components.ChannelSettingsDto{
                                    ProviderID: components.ChatOrPushProviderEnumTelegram,
                                    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>",
                                },
                            },
                        },
                        Context: map[string]components.PreviewPayloadDtoContext{
                            "key": components.CreatePreviewPayloadDtoContextStr(
                                "org-acme",
                            ),
                        },
                    },
                }, nil)
                if err != nil {
                    log.Fatal(err)
                }
                if res.GeneratePreviewResponseDto != nil {
                    switch res.GeneratePreviewResponseDto.Result.Type {
                        case components.GeneratePreviewResponseDtoResultUnionTypeMapOfAny:
                            // res.GeneratePreviewResponseDto.Result.MapOfAny is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeResult2:
                            // res.GeneratePreviewResponseDto.Result.Result2 is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeThree:
                            // res.GeneratePreviewResponseDto.Result.Three is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeResult4:
                            // res.GeneratePreviewResponseDto.Result.Result4 is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeResult5:
                            // res.GeneratePreviewResponseDto.Result.Result5 is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeSix:
                            // res.GeneratePreviewResponseDto.Result.Six is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeSeven:
                            // res.GeneratePreviewResponseDto.Result.Seven is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeEight:
                            // res.GeneratePreviewResponseDto.Result.Eight is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeNine:
                            // res.GeneratePreviewResponseDto.Result.Nine is populated
                        case components.GeneratePreviewResponseDtoResultUnionTypeTen:
                            // res.GeneratePreviewResponseDto.Result.Ten is populated
                    }

                }
            }
        - lang: typescript
          label: TypeScript
          source: |-
            import { Novu } from "@novu/api";

            const novu = new Novu({
              secretKey: "YOUR_SECRET_KEY_HERE",
            });

            async function run() {
              const result = await novu.workflows.steps.generatePreview({
                workflowId: "<id>",
                stepId: "<id>",
                generatePreviewRequestDto: {
                  previewPayload: {
                    subscriber: {
                      channels: [
                        {
                          providerId: "novu-slack",
                          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>",
                        },
                      ],
                    },
                    actor: {
                      channels: [
                        {
                          providerId: "telegram",
                          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>",
                        },
                      ],
                    },
                    context: {
                      "key": "org-acme",
                    },
                  },
                },
              });

              console.log(result);
            }

            run();
        - lang: csharp
          label: Csharp (SDK)
          source: >-
            using Novu;

            using Novu.Models.Components;

            using System.Collections.Generic;


            var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");


            var res = await sdk.Workflows.Steps.GeneratePreviewAsync(
                workflowId: "<id>",
                stepId: "<id>",
                generatePreviewRequestDto: new GeneratePreviewRequestDto() {
                    PreviewPayload = new PreviewPayloadDto() {
                        Subscriber = new SubscriberResponseDtoOptional() {
                            Channels = new List<ChannelSettingsDto>() {
                                new ChannelSettingsDto() {
                                    ProviderId = ChatOrPushProviderEnum.NovuSlack,
                                    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>",
                                },
                            },
                        },
                        Actor = new SubscriberResponseDtoOptional() {
                            Channels = new List<ChannelSettingsDto>() {
                                new ChannelSettingsDto() {
                                    ProviderId = ChatOrPushProviderEnum.Telegram,
                                    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>",
                                },
                            },
                        },
                        Context = new Dictionary<string, PreviewPayloadDtoContext>() {
                            { "key", PreviewPayloadDtoContext.CreateStr(
                                "org-acme"
                            ) },
                        },
                    },
                }
            );


            // handle response
components:
  securitySchemes:
    secretKey:
      type: apiKey
      name: Authorization
      in: header
      description: 'API key authentication. Allowed headers-- "Authorization: ApiKey
        <novu_secret_key>".'
      x-speakeasy-example: YOUR_SECRET_KEY_HERE
  schemas:
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code of the error response.
          example: 404
        timestamp:
          type: string
          description: Timestamp of when the error occurred.
          example: 2024-12-12T13:00:00Z
        path:
          type: string
          description: The path where the error occurred.
          example: /api/v1/resource
        message:
          description: Value that failed validation
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: object
              nullable: true
            - type: array
              items:
                anyOf:
                  - type: string
                    nullable: true
                  - type: number
                  - type: boolean
                  - type: object
                    additionalProperties: true
          example: "xx xx xx "
        ctx:
          type: object
          description: Optional context object for additional error details.
          additionalProperties: true
          example:
            workflowId: some_wf_id
            stepId: some_wf_id
        errorId:
          type: string
          description: >-
            Optional unique identifier for the error, useful for tracking using
            Sentry and 
                  New Relic, only available for 500.
          example: abc123
      required:
        - statusCode
        - timestamp
        - path
    ConstraintValidation:
      type: object
      properties:
        messages:
          type: array
          items:
            type: string
          description: List of validation error messages
          example:
            - Field is required
            - Invalid format
        value:
          description: Value that failed validation
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: object
            - type: array
              items:
                anyOf:
                  - type: string
                    nullable: true
                  - type: number
                  - type: boolean
                  - type: object
                    additionalProperties: true
          example: "xx xx xx "
      required:
        - messages
    ValidationErrorDto:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code of the error response.
          example: 404
        timestamp:
          type: string
          description: Timestamp of when the error occurred.
          example: 2024-12-12T13:00:00Z
        path:
          type: string
          description: The path where the error occurred.
          example: /api/v1/resource
        message:
          description: Value that failed validation
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: object
              nullable: true
            - type: array
              items:
                anyOf:
                  - type: string
                    nullable: true
                  - type: number
                  - type: boolean
                  - type: object
                    additionalProperties: true
          example: "xx xx xx "
        ctx:
          type: object
          description: Optional context object for additional error details.
          additionalProperties: true
          example:
            workflowId: some_wf_id
            stepId: some_wf_id
        errorId:
          type: string
          description: >-
            Optional unique identifier for the error, useful for tracking using
            Sentry and 
                  New Relic, only available for 500.
          example: abc123
        errors:
          type: object
          description: A record of validation errors keyed by field name
          additionalProperties:
            $ref: "#/components/schemas/ConstraintValidation"
          example:
            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
      required:
        - statusCode
        - timestamp
        - path
        - errors
    ChatOrPushProviderEnum:
      type: string
      enum:
        - slack
        - discord
        - google-chat
        - msteams
        - webex-messaging
        - mattermost
        - ryver
        - zulip
        - grafana-on-call
        - getstream
        - rocket-chat
        - whatsapp-business
        - line
        - chat-webhook
        - novu-slack
        - telegram
        - sendblue
        - photon-imessage
        - novu-web-chat
        - fcm
        - apns
        - expo
        - one-signal
        - pushpad
        - push-webhook
        - pusher-beams
        - appio
      description: The provider identifier for the credentials
    ChannelCredentials:
      type: object
      properties:
        webhookUrl:
          type: string
          description: Webhook URL used by chat app integrations. The webhook should be
            obtained from the chat app provider.
          example: https://example.com/webhook
        channel:
          type: string
          description: Channel specification for Mattermost chat notifications.
          example: general
        deviceTokens:
          description: Contains an array of the subscriber device tokens for a given
            provider. Used on Push integrations.
          example:
            - token1
            - token2
            - token3
          type: array
          items:
            type: string
        alertUid:
          type: string
          description: Alert UID for Grafana on-call webhook payload.
          example: 12345-abcde
        title:
          type: string
          description: Title to be used with Grafana on-call webhook.
          example: Critical Alert
        imageUrl:
          type: string
          description: Image URL property for Grafana on-call webhook.
          example: https://example.com/image.png
        state:
          type: string
          description: State property for Grafana on-call webhook.
          example: resolved
        externalUrl:
          type: string
          description: Link to upstream details property for Grafana on-call webhook.
          example: https://example.com/details
    ChannelSettingsDto:
      type: object
      properties:
        providerId:
          description: The provider identifier for the credentials
          $ref: "#/components/schemas/ChatOrPushProviderEnum"
        integrationIdentifier:
          type: string
          description: The integration identifier
        credentials:
          description: Credentials payload for the specified provider
          allOf:
            - $ref: "#/components/schemas/ChannelCredentials"
        _integrationId:
          type: string
          description: The unique identifier of the integration associated with this
            channel.
      required:
        - providerId
        - credentials
        - _integrationId
    RedirectDto:
      type: object
      properties:
        url:
          type: string
          description: URL to redirect to
        target:
          enum:
            - _self
            - _blank
            - _parent
            - _top
            - _unfencedTop
          type: string
          description: Target attribute for the redirect link
      required:
        - url
    SubscriberResponseDtoOptional:
      type: object
      properties:
        _id:
          type: string
          description: 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.
        firstName:
          type: string
          description: The first name of the subscriber.
          nullable: true
        lastName:
          type: string
          description: The last name of the subscriber.
          nullable: true
        email:
          type: string
          description: The email address of the subscriber.
          nullable: true
        phone:
          type: string
          description: The phone number of the subscriber.
          nullable: true
        avatar:
          type: string
          description: The URL of the subscriber's avatar image.
          nullable: true
        locale:
          type: string
          description: The locale setting of the subscriber, indicating their preferred
            language or region.
          nullable: true
        channels:
          description: An array of channel settings associated with the subscriber.
          type: array
          items:
            $ref: "#/components/schemas/ChannelSettingsDto"
        topics:
          description: An array of topics that the subscriber is subscribed to.
          deprecated: true
          type: array
          items:
            type: string
        isOnline:
          type: boolean
          description: Indicates whether the subscriber is currently online.
          nullable: true
        lastOnlineAt:
          type: string
          description: The timestamp indicating when the subscriber was last online, in
            ISO 8601 format.
          nullable: true
        __v:
          type: number
          description: The version of the subscriber document.
        data:
          type: object
          description: Additional custom data for the subscriber
          additionalProperties: true
          nullable: true
        timezone:
          type: string
          description: Timezone of the subscriber
          nullable: true
    ActionDto:
      type: object
      properties:
        label:
          type: string
          description: Label for the action button.
        redirect:
          description: Redirect configuration for the action.
          allOf:
            - $ref: "#/components/schemas/RedirectDto"
    EmailRenderOutput:
      type: object
      properties:
        subject:
          type: string
          description: Subject of the email
        body:
          type: string
          description: Body of the email
      required:
        - subject
        - body
    InAppRenderOutput:
      type: object
      properties:
        subject:
          type: string
          description: Subject of the in-app notification
        body:
          type: string
          description: Body of the in-app notification
        avatar:
          type: string
          description: Avatar for the in-app notification
        primaryAction:
          description: Primary action details
          allOf:
            - $ref: "#/components/schemas/ActionDto"
        secondaryAction:
          description: Secondary action details
          allOf:
            - $ref: "#/components/schemas/ActionDto"
        data:
          type: object
          description: Additional data
          additionalProperties: true
        redirect:
          description: Redirect details
          allOf:
            - $ref: "#/components/schemas/RedirectDto"
      required:
        - body
    SmsRenderOutput:
      type: object
      properties:
        body:
          type: string
          description: Body of the SMS message
      required:
        - body
    PushRenderOutput:
      type: object
      properties:
        subject:
          type: string
          description: Subject of the push notification
        body:
          type: string
          description: Body of the push notification
      required:
        - subject
        - body
    ChatRenderOutput:
      type: object
      properties:
        body:
          type: string
          description: Body of the chat message. Mutually exclusive with `card`.
        card:
          type: object
          description: "Rich Chat: compiled provider-agnostic card DSL. Mutually exclusive
            with `body`."
          additionalProperties: true
    TimeUnitEnum:
      type: string
      enum:
        - seconds
        - minutes
        - hours
        - days
        - weeks
        - months
      description: Time unit
    DigestRegularOutput:
      type: object
      properties:
        amount:
          type: number
          description: Amount of time units
        unit:
          description: Time unit
          $ref: "#/components/schemas/TimeUnitEnum"
        digestKey:
          type: string
          description: Optional digest key
        lookBackWindow:
          type: object
          description: Look back window configuration
      required:
        - amount
        - unit
    PreviewErrorDto:
      type: object
      properties:
        title:
          type: string
          description: Short error title
        message:
          type: string
          description: Detailed error message
        hint:
          type: string
          description: Actionable hint for the user
      required:
        - title
        - message
        - hint
    PreviewPayloadDto:
      type: object
      properties:
        subscriber:
          description: Partial subscriber information
          allOf:
            - $ref: "#/components/schemas/SubscriberResponseDtoOptional"
        actor:
          description: Partial actor information
          allOf:
            - $ref: "#/components/schemas/SubscriberResponseDtoOptional"
        payload:
          type: object
          description: Payload data
          additionalProperties: true
        steps:
          type: object
          description: Steps data
          additionalProperties: true
        context:
          type: object
          additionalProperties:
            oneOf:
              - type: string
                description: Simple context id
                example: org-acme
              - type: object
                description: Rich context object with id and optional data
                properties:
                  id:
                    type: string
                    example: org-acme
                  data:
                    type: object
                    description: Optional additional context data
                    additionalProperties: true
                    example:
                      name: Acme Corp
                      region: us-east-1
                required:
                  - id
        env:
          type: object
          description: Environment variables data
          additionalProperties: true
    GeneratePreviewResponseDto:
      type: object
      properties:
        previewPayloadExample:
          description: Preview payload example
          allOf:
            - $ref: "#/components/schemas/PreviewPayloadDto"
        schema:
          type: object
          description: The payload schema that was used to generate the preview payload
            example
          nullable: true
          additionalProperties: true
        novuSignature:
          type: string
          description: Sample novu-signature header value for HTTP request steps
        result:
          description: Preview result
          oneOf:
            - type: object
              additionalProperties: true
            - properties:
                type:
                  enum:
                    - email
                preview:
                  $ref: "#/components/schemas/EmailRenderOutput"
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - email
                preview:
                  $ref: "#/components/schemas/EmailRenderOutput"
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - in_app
                preview:
                  $ref: "#/components/schemas/InAppRenderOutput"
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - sms
                preview:
                  $ref: "#/components/schemas/SmsRenderOutput"
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - push
                preview:
                  $ref: "#/components/schemas/PushRenderOutput"
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - chat
                preview:
                  $ref: "#/components/schemas/ChatRenderOutput"
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - tool
                preview:
                  type: object
                  additionalProperties: true
                error:
                  $ref: "#/components/schemas/PreviewErrorDto"
            - properties:
                type:
                  enum:
                    - delay
                preview:
                  $ref: "#/components/schemas/DigestRegularOutput"
            - properties:
                type:
                  enum:
                    - digest
                preview:
                  $ref: "#/components/schemas/DigestRegularOutput"
      required:
        - previewPayloadExample
        - result
    GeneratePreviewRequestDto:
      type: object
      properties:
        controlValues:
          type: object
          description: Optional control values
          additionalProperties: true
        previewPayload:
          description: Optional payload for preview generation
          allOf:
            - $ref: "#/components/schemas/PreviewPayloadDto"
  headers:
    Content-Type:
      required: true
      description: The MIME type of the response body.
      schema:
        type: string
      example: application/json
    RateLimit-Limit:
      required: false
      description: The number of requests that the client is permitted to make per
        second. The actual maximum may differ when burst is enabled.
      schema:
        type: string
      example: "100"
    RateLimit-Remaining:
      required: false
      description: The number of requests remaining until the next window.
      schema:
        type: string
      example: "93"
    RateLimit-Reset:
      required: false
      description: The remaining seconds until a request of the same cost will be refreshed.
      schema:
        type: string
      example: "8"
    RateLimit-Policy:
      required: false
      description: The rate limit policy that was used to evaluate the request.
      schema:
        type: string
      example: 100;w=1;burst=110;comment="token bucket";category="trigger";cost="single"
    Retry-After:
      required: false
      description: The number of seconds after which the client may retry the request
        that was previously rejected.
      schema:
        type: string
      example: "8"
    Idempotency-Key:
      required: false
      description: The idempotency key used to evaluate the request.
      schema:
        type: string
      example: "8"
    Idempotency-Replay:
      required: false
      description: Whether the request was a replay of a previous request.
      schema:
        type: string
      example: "true"
````
