> 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

# GetEmailContent

# Package: emails

# Namespace: AutomationEmailActionsService

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

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

## Introduction

Retrieves the email content of an automation's send email action.

---

## REST API

### Schema

```
 Method: getEmailContent
 Description: Retrieves the email content of an automation's send email action.
 URL: https://www.wixapis.com/emails-automations/v1/automations/{automationId}/email-actions/{actionId}/email-content
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  automationId, actionId
 Method parameters: 
   param name: actionId | type:   none | required: true 
   param name: automationId | type:   none | required: true 
   query param name: language | type: language | description: Language to retrieve the content in. Defaults to the site's primary language.  | validation: format LANGUAGE
 Return type: GetEmailContentResponse
  - name: content | type: AutomationEmailContent | description: Email content of the action.  
     - name: emailSubject | type: string | description: Subject line displayed in recipients' inboxes.  | validation: maxLength 1000
     - name: emailPreheader | type: string | description: Short preview text shown after the subject line in some email clients.  | validation: maxLength 1000
     - name: composer | type: Composer | description: Editor content and placeholder fallback values, using the canonical Email Marketing [Composer](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/campaign/update-composer.md) contract.  
        - name: composerDataJson | type: string | description: Editor content for the campaign. The format depends on `campaignEditorType`:  - `WEB`: Wix proprietary JSON format used by the drag-and-drop email editor. - `MOBILE`: A subset of the `WEB` format, used by the mobile email editor. - `MJML`: MJML markup wrapped in a JSON object under key "mjml". - `HTML`: HTML code wrapped in a JSON object under key "html".  Passing the wrong format for the given `campaignEditorType` causes a silent failure when sending or previewing the campaign.  | validation: maxLength 10000000
        - name: defaultValues | type: DefaultValues | description: Fallback values for dynamic placeholders in the campaign content.  
           - name: map | type: object | description: Map of placeholder keys to their default values.  | validation: maxItems 500, format map
     - name: editorType | type: Enum | description: Editor type that produced `composer.composerDataJson`, and therefore the format that field is in. Set it whenever the content being written is in a different format than what is stored - the renderer picks its path from this, and a mismatch fails silently when previewing or sending. Leaving it unset on update keeps existing type.  Automations support `WEB` and `MJML`.  
         - enum:
         -     WEB: Wix classic drag-and-drop email editor. The `composerDataJson` is stored in Wix proprietary JSON format.
         -     MOBILE: Wix classic mobile-optimized email editor. The `composerDataJson` is stored in a subset of the `WEB` format.
         -     MJML: AI-powered email editor. The `composerDataJson` is stored in MJML markup wrapped in JSON.
         -     HTML: HTML email editor. The `composerDataJson` is stored in raw HTML code wrapped in JSON.

 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

### Get Email Content
Retrieve the email content of an automation's send email action.

```curl
curl -X GET \
'https://www.wixapis.com/emails-automations/v1/automations/0029458c-a8e1-4d04-bd88-ad0af11cb678/email-actions/f6f72a5c-77ef-4672-ada1-83aa45de7f2c/email-content' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automationsEmailActions.automationEmailAction.getEmailContent(identifiers, options)
 Description: Retrieves the email content of an automation's send email action.
 # 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: GetEmailContentIdentifiers  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: GetEmailContentOptions  none  
        - name: language | type: string | description: Language to retrieve the content in. Defaults to the site's primary language.  | validation: format LANGUAGE
 Return type: PROMISE<GetEmailContentResponse>
  - name: content | type: AutomationEmailContent | description: Email content of the action.  
     - name: emailSubject | type: string | description: Subject line displayed in recipients' inboxes.  | validation: maxLength 1000
     - name: emailPreheader | type: string | description: Short preview text shown after the subject line in some email clients.  | validation: maxLength 1000
     - name: composer | type: Composer | description: Editor content and placeholder fallback values, using the canonical Email Marketing [Composer](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/campaign/update-composer.md) contract.  
        - name: composerDataJson | type: string | description: Editor content for the campaign. The format depends on `campaignEditorType`:  - `WEB`: Wix proprietary JSON format used by the drag-and-drop email editor. - `MOBILE`: A subset of the `WEB` format, used by the mobile email editor. - `MJML`: MJML markup wrapped in a JSON object under key "mjml". - `HTML`: HTML code wrapped in a JSON object under key "html".  Passing the wrong format for the given `campaignEditorType` causes a silent failure when sending or previewing the campaign.  | validation: maxLength 10000000
        - name: defaultValues | type: DefaultValues | description: Fallback values for dynamic placeholders in the campaign content.  
           - name: map | type: object | description: Map of placeholder keys to their default values.  | validation: maxItems 500, format map
     - name: editorType | type: Enum | description: Editor type that produced `composer.composerDataJson`, and therefore the format that field is in. Set it whenever the content being written is in a different format than what is stored - the renderer picks its path from this, and a mismatch fails silently when previewing or sending. Leaving it unset on update keeps existing type.  Automations support `WEB` and `MJML`.  
         - enum:
         -     WEB: Wix classic drag-and-drop email editor. The `composerDataJson` is stored in Wix proprietary JSON format.
         -     MOBILE: Wix classic mobile-optimized email editor. The `composerDataJson` is stored in a subset of the `WEB` format.
         -     MJML: AI-powered email editor. The `composerDataJson` is stored in MJML markup wrapped in JSON.
         -     HTML: HTML email editor. The `composerDataJson` is stored in raw HTML code wrapped in JSON.

 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

### Get email content
Retrieve the email content of an automation's send email action.

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

async function getEmailContent() {
  const response = await automationEmailAction.getEmailContent({
    automationId: "0029458c-a8e1-4d04-bd88-ad0af11cb678",
    actionId: "f6f72a5c-77ef-4672-ada1-83aa45de7f2c",
  });
}

/* Promise resolves to:
 * {
 *   "content": {
 *     "emailSubject": "Changes to your ${subscriptionName} subscription price",
 *     "emailPreheader": "Your subscription price was updated",
 *     "composer": {
 *       "composerDataJson": "{\"regions\":[{\"type\":\"text\",\"data\":{\"html\":\"<p>Changes to your <bdi>${subscriptionName}</bdi> subscription price</p>\"}}]}",
 *       "defaultValues": {
 *         "map": {
 *           "subscriptionName": "",
 *           "priceUpdateDate": "",
 *           "itemUpdatedPrice": "",
 *           "cycleType": ""
 *         }
 *       }
 *     },
 *     "editorType": "WEB"
 *   }
 * }
 */

```

### getEmailContent (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 getEmailContent(identifiers,options) {
  const response = await myWixClient.automationEmailAction.getEmailContent(identifiers,options);
};
```

---