> 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

# GetAutomationEmailAction

# Package: emails

# Namespace: AutomationEmailActionsService

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

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

## Introduction

Retrieves an automation's send email action: its email type, notification topic, recipients and sender details.

To change the action, call [Update Automation Email Action](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/update-automation-email-action.md)
with just the fields you're changing.

---

## REST API

### Schema

```
 Method: getAutomationEmailAction
 Description: Retrieves an automation's send email action: its email type, notification topic, recipients and sender details.  To change the action, call [Update Automation Email Action](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/update-automation-email-action.md) with just the fields you're changing.
 URL: https://www.wixapis.com/emails-automations/v1/automations/{automationId}/email-actions/{actionId}
 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 
 Return type: GetAutomationEmailActionResponse
  - name: automationEmailAction | type: AutomationEmailAction | description: The send email action.  
     - name: emailType | type: EmailType | description: Type of the email, which determines whether contacts can unsubscribe from it.  Default: `PROMOTIONAL`  
         - enum:
         -     PROMOTIONAL: Marketing email. Sent only to contacts subscribed to marketing, who can unsubscribe from its notification topic.
         -     BUSINESS_TRANSACTIONAL: Email about the contact's activity with the business, such as an order confirmation. Contacts can unsubscribe from its notification topic.
         -     BUSINESS_CRITICAL: Email contacts must receive, such as a password reset. Sent to every contact, including unsubscribed ones.
     - name: notificationTopicId | type: string | description: GUGUID of the notification topic contacts unsubscribe from to stop receiving the email.  - `PROMOTIONAL`: A promotional topic. - `BUSINESS_TRANSACTIONAL`: A transactional topic.  Required if `emailType` is `BUSINESS_TRANSACTIONAL`. Can't be specified if `emailType` is `BUSINESS_CRITICAL`, since contacts can't unsubscribe from these emails, and isn't returned for them.  The topic isn't validated when the action is saved, so make sure it exists and matches `emailType`.  Default: For a `PROMOTIONAL` email, the general promotional topic.  | validation: format GUID
     - name: senderDetailsId | type: string | description: GUGUID of the sender details to send the email with, as in [Assign Sender Details](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/assign-sender-details.md).  Returned only when sender details are explicitly assigned to the action.  Default: The site's default sender details if they exist, and Wix-branded sender details otherwise.  | validation: format GUID
     - name: recipients | type: Recipients | description: Who the email is sent to.  `CUSTOM` recipients whose single audience is the trigger contact (an `explicitData_triggerMainContact` audience) or the site owner are returned as the equivalent `TRIGGER_CONTACT` or `SITE_OWNER` recipients.  Default: The site owner.  
        - ONE-OF: 
           - name: triggerContactOptions | type: TriggerContactOptions | description: Required if `recipientType` is `TRIGGER_CONTACT`.  
              - name: contactIdPath | type: string | description: Path in the trigger payload schema to the GUGUID of the contact to send the email to. For example, `contactId` or `contact.id`. Usually the property marked with `"identityType": "contact"`.  Supports a path of property names and array indexes, such as `items[0].contactId`, rather than an expression. Property names can contain letters, digits, underscores and hyphens.  The path isn't checked against the trigger payload schema, so make sure it exists in the trigger's payload.  | validation: maxLength 200
           - name: customOptions | type: CustomOptions | description: Required if `recipientType` is `CUSTOM`.  
              - name: audiences | type: array<Audience> | description: Audiences to send the email to, as in the [Audience API](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/introduction.md). Each audience's `audienceProviderId` is the GUID of a provider returned by [List Audience Providers](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/list-audience-providers.md), or one of these providers, which resolve participants from the trigger payload when the automation runs: - `explicitData_triggerMainContact`: `{"participants": [{"type": "CONTACT", "value": "{{var(\"contactId\")}}"}]}`, where `type` is `CONTACT` or `EMAIL` and `value` refers to a path in the trigger payload. - `explicitData_accountUser`: `{"participants": [{"type": "WIX_USER", "value": "{{var(\"userId\")}}"}]}`, where `value` refers to a path in the trigger payload.  Each `audienceProviderId` is validated, but `audienceProviderData` isn't, so make sure it's the input its provider expects.  Min: 1 audience  | validation: maxItems 10
                 - name: audienceProviderId | type: string | description: identifier of the provider  | validation: minLength 1, maxLength 100
                 - name: audienceProviderData | type: object | description: audience provider data is needed in order to list participants of each provider  
        - name: recipientType | type: RecipientType | description: Type of the recipients. Required when `recipients` is specified.  
             - enum:
             -     TRIGGER_CONTACT: The contact at `triggerContactOptions.contactIdPath` in the trigger payload.
             -     SITE_OWNER: The site owner.
             -     CUSTOM: The participants of `customOptions.audiences`.

 Possible Errors:
   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


```

### Examples

### Get Automation Email Action
Retrieve the email type, notification topic, recipients and sender details 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' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automationsEmailActions.automationEmailAction.getAutomationEmailAction(identifiers)
 Description: Retrieves an automation's send email action: its email type, notification topic, recipients and sender details.  To change the action, call [Update Automation Email Action](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/update-automation-email-action.md) with just the fields you're changing.
 # 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: GetAutomationEmailActionIdentifiers  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
 Return type: PROMISE<GetAutomationEmailActionResponse>
  - name: automationEmailAction | type: AutomationEmailAction | description: The send email action.  
     - name: emailType | type: EmailType | description: Type of the email, which determines whether contacts can unsubscribe from it.  Default: `PROMOTIONAL`  
         - enum:
         -     PROMOTIONAL: Marketing email. Sent only to contacts subscribed to marketing, who can unsubscribe from its notification topic.
         -     BUSINESS_TRANSACTIONAL: Email about the contact's activity with the business, such as an order confirmation. Contacts can unsubscribe from its notification topic.
         -     BUSINESS_CRITICAL: Email contacts must receive, such as a password reset. Sent to every contact, including unsubscribed ones.
     - name: notificationTopicId | type: string | description: GUGUID of the notification topic contacts unsubscribe from to stop receiving the email.  - `PROMOTIONAL`: A promotional topic. - `BUSINESS_TRANSACTIONAL`: A transactional topic.  Required if `emailType` is `BUSINESS_TRANSACTIONAL`. Can't be specified if `emailType` is `BUSINESS_CRITICAL`, since contacts can't unsubscribe from these emails, and isn't returned for them.  The topic isn't validated when the action is saved, so make sure it exists and matches `emailType`.  Default: For a `PROMOTIONAL` email, the general promotional topic.  | validation: format GUID
     - name: senderDetailsId | type: string | description: GUGUID of the sender details to send the email with, as in [Assign Sender Details](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/assign-sender-details.md).  Returned only when sender details are explicitly assigned to the action.  Default: The site's default sender details if they exist, and Wix-branded sender details otherwise.  | validation: format GUID
     - name: recipients | type: Recipients | description: Who the email is sent to.  `CUSTOM` recipients whose single audience is the trigger contact (an `explicitData_triggerMainContact` audience) or the site owner are returned as the equivalent `TRIGGER_CONTACT` or `SITE_OWNER` recipients.  Default: The site owner.  
        - ONE-OF: 
           - name: triggerContactOptions | type: TriggerContactOptions | description: Required if `recipientType` is `TRIGGER_CONTACT`.  
              - name: contactIdPath | type: string | description: Path in the trigger payload schema to the GUGUID of the contact to send the email to. For example, `contactId` or `contact.id`. Usually the property marked with `"identityType": "contact"`.  Supports a path of property names and array indexes, such as `items[0].contactId`, rather than an expression. Property names can contain letters, digits, underscores and hyphens.  The path isn't checked against the trigger payload schema, so make sure it exists in the trigger's payload.  | validation: maxLength 200
           - name: customOptions | type: CustomOptions | description: Required if `recipientType` is `CUSTOM`.  
              - name: audiences | type: array<Audience> | description: Audiences to send the email to, as in the [Audience API](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/introduction.md). Each audience's `audienceProviderId` is the GUID of a provider returned by [List Audience Providers](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/list-audience-providers.md), or one of these providers, which resolve participants from the trigger payload when the automation runs: - `explicitData_triggerMainContact`: `{"participants": [{"type": "CONTACT", "value": "{{var(\"contactId\")}}"}]}`, where `type` is `CONTACT` or `EMAIL` and `value` refers to a path in the trigger payload. - `explicitData_accountUser`: `{"participants": [{"type": "WIX_USER", "value": "{{var(\"userId\")}}"}]}`, where `value` refers to a path in the trigger payload.  Each `audienceProviderId` is validated, but `audienceProviderData` isn't, so make sure it's the input its provider expects.  Min: 1 audience  | validation: maxItems 10
                 - name: audienceProviderId | type: string | description: identifier of the provider  | validation: minLength 1, maxLength 100
                 - name: audienceProviderData | type: object | description: audience provider data is needed in order to list participants of each provider  
        - name: recipientType | type: RecipientType | description: Type of the recipients. Required when `recipients` is specified.  
             - enum:
             -     TRIGGER_CONTACT: The contact at `triggerContactOptions.contactIdPath` in the trigger payload.
             -     SITE_OWNER: The site owner.
             -     CUSTOM: The participants of `customOptions.audiences`.

 Possible Errors:
   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


```

### Examples

### Get automation email action
Retrieve the email type, notification topic, recipients and sender details of an automation's send email action.

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

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

/* Promise resolves to:
 * {
 *   "automationEmailAction": {
 *     "emailType": "PROMOTIONAL",
 *     "notificationTopicId": "002195b2-8396-44dd-85d3-b89839f70982",
 *     "senderDetailsId": "3f9c1a2e-6b7d-4e8f-9a1b-5c2d3e4f5a6b",
 *     "recipients": {
 *       "recipientType": "TRIGGER_CONTACT",
 *       "triggerContactOptions": {
 *         "contactIdPath": "contact.id"
 *       }
 *     }
 *   }
 * }
 */

```

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

---