> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# PreviewEmailContent

# Package: emails

# Namespace: AutomationEmailActionsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/preview-email-content.md

## Permission Scopes:
Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING

## Introduction

Renders the email content of an automation's send email action as HTML, without sending it.

Placeholders are replaced only by the values in `customPayload`. When it's omitted, no
values are available, so every placeholder is left unresolved - visible as its own reference
in the rendered content, or dropped when `removeUnresolvedPlaceholders` is `true`.

---

## REST API

### Schema

```
 Method: previewEmailContent
 Description: Renders the email content of an automation's send email action as HTML, without sending it.  Placeholders are replaced only by the values in `customPayload`. When it's omitted, no values are available, so every placeholder is left unresolved - visible as its own reference in the rendered content, or dropped when `removeUnresolvedPlaceholders` is `true`.
 URL: https://www.wixapis.com/emails-automations/v1/automations/{automationId}/email-actions/{actionId}/email-content/preview
 Method: POST
 Method parameters:
   param name: customPayload | type: CustomPayload | description: Values to render the email content's placeholders with.  Currently supports at most 1000 values per level, nested up to 10 levels deep.  
    - ONE-OF: 
     - name: placeholders | type: Map | description: Placeholder values, keyed the way the content references them. Values may carry recipient data.  
        - name: variables | type: Map<string,PlaceholderContent> | description: Nested placeholder values keyed by name.  | validation: format map
           - ONE-OF: 
              - name: text | type: PlainText | description: Plain text replacement value.  
                 - name: text | type: string | description: The plain text string.  
              - name: html | type: Html | description: HTML replacement value. Rendered as HTML in supported contexts.  
                 - name: html | type: string | description: The HTML string.  
              - name: money | type: Money | description: Monetary value.  
                 - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.  | validation: format DECIMAL_VALUE
                 - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).  | validation: format CURRENCY
                 - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.  
              - name: dateTime | type: DateTime | description: Date and time value.  
                 - name: timestamp | type: string | description: The point in time.  | validation: format date-time
                 - name: timeZone | type: string | description: IANA time zone name (for example, `"Asia/Jerusalem"`). Used to format the date and time for the recipient's locale.  
              - name: map | type: Map | description: Nested map of placeholder values. Used for structured data.  
              - name: array | type: Array | description: List of placeholder values.  
                 - name: items | type: array<PlaceholderContent> | description: Ordered list of placeholder values.  
              - name: enum | type: Enum | description: Enum value with a localized display string.  
                 - name: value | type: string | description: Internal enum identifier.  
                 - name: translation | type: string | description: Localized display string for the enum value.  
              - name: attachment | type: Attachment | description: File attachment with a name and download URL.  
                 - name: fileName | type: string | description: Display name of the attached file.  
                 - name: downloadUrl | type: string | description: URL to download the attached file.  
              - name: integer | type: Integer | description: Integer value.  
                 - name: value | type: integer | description: The integer value.  
              - name: decimal | type: Decimal | description: Decimal (fixed-point) value.  
                 - name: value | type: string | description: The decimal value as a string.  | validation: format DECIMAL_VALUE
              - name: localDate | type: LocalDate | description: Local date value without time or timezone.  
                 - name: value | type: string | description: The local date in `YYYY-MM-DD` format.  | validation: format LOCAL_DATE
     - name: triggerPayload | type: object | description: Data in the format the action receives when the automation runs. Placeholder values are derived from it, so the content can be rendered against real data without knowing which placeholder keys it uses.  
   param name: language | type: language | description: Language to render the content in. Defaults to the site's primary language.  | validation: format LANGUAGE
   param name: removeUnresolvedPlaceholders | type: removeUnresolvedPlaceholders | description: Whether to remove unresolved placeholders from the rendered content.  Default: `false`, leaving them visible as their own references.  
 Return type: PreviewEmailContentResponse
  - name: html | type: string | description: Rendered email content.  | validation: maxLength 10000000
  - name: emailSubject | type: string | description: Subject line, with placeholders replaced by their values.  | validation: maxLength 1000

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: LANGUAGE_NOT_CONFIGURED_FOR_SITE | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NOT_AN_EMAIL_ACTION | Description: none
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: AUTOMATION_ACTION_NOT_FOUND | Description: none
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CONTENT_NOT_CONFIGURED | Description: none


```

### Examples

### Preview Email Content
Render an automation's send email action content as HTML, without sending it.

```curl
curl -X POST \
'https://www.wixapis.com/emails-automations/v1/automations/0029458c-a8e1-4d04-bd88-ad0af11cb678/email-actions/f6f72a5c-77ef-4672-ada1-83aa45de7f2c/email-content/preview' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "customPayload": {
    "placeholders": {
      "variables": {
        "subscriptionName": {
          "text": {
            "text": "Pro Plan"
          }
        },
        "priceUpdateDate": {
          "text": {
            "text": "March 1, 2026"
          }
        },
        "itemUpdatedPrice": {
          "text": {
            "text": "$29.99"
          }
        },
        "cycleType": {
          "text": {
            "text": "month"
          }
        }
      }
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automationsEmailActions.automationEmailAction.previewEmailContent(identifiers, options)
 Description: Renders the email content of an automation's send email action as HTML, without sending it.  Placeholders are replaced only by the values in `customPayload`. When it's omitted, no values are available, so every placeholder is left unresolved - visible as its own reference in the rendered content, or dropped when `removeUnresolvedPlaceholders` is `true`.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  identifiers.automationId, identifiers.actionId, identifiers
 Method parameters: 
   param name: identifiers | type: PreviewEmailContentIdentifiers  none | required: true 
        - name: automationId | type: string | description: GUID of the automation the action belongs to. | required: true | validation: format GUID
        - name: actionId | type: string | description: GUID of the send email action within the automation. | required: true | validation: format GUID
   param name: options | type: PreviewEmailContentOptions  none  
        - name: language | type: string | description: Language to render the content in. Defaults to the site's primary language.  | validation: format LANGUAGE
        - name: customPayload | type: CustomPayload | description: Values to render with. When omitted, placeholders stay unresolved in the rendered content.  
           - ONE-OF: 
              - name: placeholders | type: Map | description: Placeholder values, keyed the way the content references them. Values may carry recipient data.  
                 - name: variables | type: Map<string,PlaceholderContent> | description: Nested placeholder values keyed by name.  | validation: format map
                    - ONE-OF: 
                       - name: text | type: PlainText | description: Plain text replacement value.  
                          - name: text | type: string | description: The plain text string.  
                       - name: html | type: Html | description: HTML replacement value. Rendered as HTML in supported contexts.  
                          - name: html | type: string | description: The HTML string.  
                       - name: money | type: Money | description: Monetary value.  
                          - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.  | validation: format DECIMAL_VALUE
                          - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).  | validation: format CURRENCY
                          - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.  
                       - name: dateTime | type: DateTime | description: Date and time value.  
                          - name: timestamp | type: Date | description: The point in time.  
                          - name: timeZone | type: string | description: IANA time zone name (for example, `"Asia/Jerusalem"`). Used to format the date and time for the recipient's locale.  
                       - name: map | type: Map | description: Nested map of placeholder values. Used for structured data.  
                       - name: array | type: Array | description: List of placeholder values.  
                          - name: items | type: array<PlaceholderContent> | description: Ordered list of placeholder values.  
                       - name: enum | type: Enum | description: Enum value with a localized display string.  
                          - name: value | type: string | description: Internal enum identifier.  
                          - name: translation | type: string | description: Localized display string for the enum value.  
                       - name: attachment | type: Attachment | description: File attachment with a name and download URL.  
                          - name: fileName | type: string | description: Display name of the attached file.  
                          - name: downloadUrl | type: string | description: URL to download the attached file.  
                       - name: integer | type: Integer | description: Integer value.  
                          - name: value | type: integer | description: The integer value.  
                       - name: decimal | type: Decimal | description: Decimal (fixed-point) value.  
                          - name: value | type: string | description: The decimal value as a string.  | validation: format DECIMAL_VALUE
                       - name: localDate | type: LocalDate | description: Local date value without time or timezone.  
                          - name: value | type: string | description: The local date in `YYYY-MM-DD` format.  | validation: format LOCAL_DATE
              - name: triggerPayload | type: object | description: Data in the format the action receives when the automation runs. Placeholder values are derived from it, so the content can be rendered against real data without knowing which placeholder keys it uses.  
        - name: removeUnresolvedPlaceholders | type: boolean | description: Whether to remove unresolved placeholders from the rendered content.  Default: `false`, leaving them visible as their own references.  
 Return type: PROMISE<PreviewEmailContentResponse>
  - name: html | type: string | description: Rendered email content.  | validation: maxLength 10000000
  - name: emailSubject | type: string | description: Subject line, with placeholders replaced by their values.  | validation: maxLength 1000

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: LANGUAGE_NOT_CONFIGURED_FOR_SITE | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NOT_AN_EMAIL_ACTION | Description: none
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: AUTOMATION_ACTION_NOT_FOUND | Description: none
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CONTENT_NOT_CONFIGURED | Description: none


```

### Examples

### Preview email content
Render an automation's send email action content as HTML, without sending it.

```javascript
import { automationEmailAction } from "@wix/automations-email-actions";

async function previewEmailContent() {
  const response = await automationEmailAction.previewEmailContent(
    {
      automationId: "0029458c-a8e1-4d04-bd88-ad0af11cb678",
      actionId: "f6f72a5c-77ef-4672-ada1-83aa45de7f2c",
    },
    {
      customPayload: {
        placeholders: {
          variables: {
            subscriptionName: { text: { text: "Pro Plan" } },
            priceUpdateDate: { text: { text: "March 1, 2026" } },
            itemUpdatedPrice: { text: { text: "$29.99" } },
            cycleType: { text: { text: "month" } },
          },
        },
      },
    },
  );
}

/* Promise resolves to:
 * {
 *   "html": "<!doctype html><html lang=\"en\"><body><p>We're writing to let you know that starting on <bdi>March 1, 2026</bdi>, the price of your <bdi>Pro Plan</bdi> subscription will change to <bdi>$29.99</bdi> / <bdi>month</bdi>.</p></body></html>",
 *   "emailSubject": "Changes to your Pro Plan subscription price"
 * }
 */

```

### previewEmailContent (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { automationEmailAction } from '@wix/automations-email-actions';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { automationEmailAction },
  // Include the auth strategy and host as relevant
});


async function previewEmailContent(identifiers,options) {
  const response = await myWixClient.automationEmailAction.previewEmailContent(identifiers,options);
};
```

---