> 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

# UpdateAutomationEmailAction

# Package: emails

# Namespace: AutomationEmailActionsService

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

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

## Introduction

Updates an automation's send email action.

Only the fields listed in `fieldMask` are updated. A listed field that's left empty is reset to its default, so
passing `"senderDetailsId": null` returns the action to the site's default sender details.

Some fields are updated together:
- Changing `emailType` also replaces `notificationTopicId`, with the one in the request, or with the new email
type's default when it's left empty.
- Updating `recipients`, or any of its fields, replaces all the action's recipients with the ones in the request.

At least 1 field must be listed, and each `fieldMask` path must name a field of the action. A path can end at a
repeated field, such as `recipients.customOptions.audiences`, but can't continue into it. Other paths are rejected
with `INVALID_ARGUMENT`.

Changes apply from the automation's next run, whether the automation is active or not. The action is stored in
the automation's configuration, so the update increments the automation's `revision`. Retrieve the automation again
before updating it with [Update Automation](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/update-automation.md).

Specifying `CUSTOM` recipients also requires the `AUDIENCE.AUDIENCE_PROVIDER_READ` permission, to check their
audience providers.

There's no revision to pass and no concurrency check: the last write wins.

---

## REST API

### Schema

```
 Method: updateAutomationEmailAction
 Description: Updates an automation's send email action.  Only the fields listed in `fieldMask` are updated. A listed field that's left empty is reset to its default, so passing `"senderDetailsId": null` returns the action to the site's default sender details.  Some fields are updated together: - Changing `emailType` also replaces `notificationTopicId`, with the one in the request, or with the new email type's default when it's left empty. - Updating `recipients`, or any of its fields, replaces all the action's recipients with the ones in the request.  At least 1 field must be listed, and each `fieldMask` path must name a field of the action. A path can end at a repeated field, such as `recipients.customOptions.audiences`, but can't continue into it. Other paths are rejected with `INVALID_ARGUMENT`.  Changes apply from the automation's next run, whether the automation is active or not. The action is stored in the automation's configuration, so the update increments the automation's `revision`. Retrieve the automation again before updating it with [Update Automation](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/update-automation.md).  Specifying `CUSTOM` recipients also requires the `AUDIENCE.AUDIENCE_PROVIDER_READ` permission, to check their audience providers.  There's no revision to pass and no concurrency check: the last write wins.
 URL: https://www.wixapis.com/emails-automations/v1/automations/{automationId}/email-actions/{actionId}
 Method: PATCH
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  automationEmailAction
 Method parameters: 
   param name: automationEmailAction | type: AutomationEmailAction | description: An automation email action represents the email sent by an automation's `triggered-emails` action: its type, recipients and sender. The email content is managed separately, with [Get Email Content](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/get-email-content.md) and [Set Email Content](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/set-email-content.md).  An action isn't identified by an GUID of its own. An existing action is addressed together with the automation it belongs to, and a new one is described before it's added to an automation, so it has no identifiers yet. | required: true 
        - 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`.
 Return type: UpdateAutomationEmailActionResponse
  - name: automationEmailAction | type: AutomationEmailAction | description: The send email action after the update.  
     - 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: UNKNOWN_AUDIENCE_PROVIDER | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_RECIPIENTS | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NOTIFICATION_TOPIC_REQUIRED | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NOTIFICATION_TOPIC_NOT_SUPPORTED | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_CONTACT_ID_PATH | 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


```

### Examples

### Update Automation Email Action
Send an automation's email to contacts with a label, and return it to the site's default sender details.

```curl
curl -X PATCH \
'https://www.wixapis.com/emails-automations/v1/automations/0029458c-a8e1-4d04-bd88-ad0af11cb678/email-actions/f6f72a5c-77ef-4672-ada1-83aa45de7f2c' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "automationEmailAction": {
    "recipients": {
      "recipientType": "CUSTOM",
      "customOptions": {
        "audiences": [
          {
            "audienceProviderId": "74bff718-5977-47f2-9e5f-a9fd0047fd1f_labels",
            "audienceProviderData": {
              "labelIds": ["custom.vip"]
            }
          }
        ]
      }
    },
    "senderDetailsId": null
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automationsEmailActions.automationEmailAction.updateAutomationEmailAction(identifiers, automationEmailAction)
 Description: Updates an automation's send email action.  Only the fields listed in `fieldMask` are updated. A listed field that's left empty is reset to its default, so passing `"senderDetailsId": null` returns the action to the site's default sender details.  Some fields are updated together: - Changing `emailType` also replaces `notificationTopicId`, with the one in the request, or with the new email type's default when it's left empty. - Updating `recipients`, or any of its fields, replaces all the action's recipients with the ones in the request.  At least 1 field must be listed, and each `fieldMask` path must name a field of the action. A path can end at a repeated field, such as `recipients.customOptions.audiences`, but can't continue into it. Other paths are rejected with `INVALID_ARGUMENT`.  Changes apply from the automation's next run, whether the automation is active or not. The action is stored in the automation's configuration, so the update increments the automation's `revision`. Retrieve the automation again before updating it with [Update Automation](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/update-automation.md).  Specifying `CUSTOM` recipients also requires the `AUDIENCE.AUDIENCE_PROVIDER_READ` permission, to check their audience providers.  There's no revision to pass and no concurrency check: the last write wins.
 # 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, automationEmailAction, identifiers
 Method parameters: 
   param name: automationEmailAction | type: UpdateAutomationEmailAction | description: An automation email action represents the email sent by an automation's `triggered-emails` action: its type, recipients and sender. The email content is managed separately, with [Get Email Content](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/get-email-content.md) and [Set Email Content](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/automation-email-action/set-email-content.md).  An action isn't identified by an GUID of its own. An existing action is addressed together with the automation it belongs to, and a new one is described before it's added to an automation, so it has no identifiers yet. | required: true 
        - 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`.
   param name: identifiers | type: UpdateAutomationEmailActionIdentifiers  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<UpdateAutomationEmailActionResponse>
  - name: automationEmailAction | type: AutomationEmailAction | description: The send email action after the update.  
     - 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: UNKNOWN_AUDIENCE_PROVIDER | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_RECIPIENTS | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NOTIFICATION_TOPIC_REQUIRED | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NOTIFICATION_TOPIC_NOT_SUPPORTED | Description: none
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_CONTACT_ID_PATH | 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


```

### Examples

### Update automation email action
Send an automation's email to contacts with a label. Only `recipients` is updated, so the action's other settings stay as they are.

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

async function updateAutomationEmailAction() {
  const response = await automationEmailAction.updateAutomationEmailAction(
    {
      automationId: "0029458c-a8e1-4d04-bd88-ad0af11cb678",
      actionId: "f6f72a5c-77ef-4672-ada1-83aa45de7f2c",
    },
    {
      recipients: {
        recipientType: "CUSTOM",
        customOptions: {
          audiences: [
            {
              audienceProviderId: "74bff718-5977-47f2-9e5f-a9fd0047fd1f_labels",
              audienceProviderData: { labelIds: ["custom.vip"] },
            },
          ],
        },
      },
    },
  );
}

/* Promise resolves to:
 * {
 *   "automationEmailAction": {
 *     "emailType": "PROMOTIONAL",
 *     "notificationTopicId": "002195b2-8396-44dd-85d3-b89839f70982",
 *     "senderDetailsId": "3f9c1a2e-6b7d-4e8f-9a1b-5c2d3e4f5a6b",
 *     "recipients": {
 *       "recipientType": "CUSTOM",
 *       "customOptions": {
 *         "audiences": [
 *           {
 *             "audienceProviderId": "74bff718-5977-47f2-9e5f-a9fd0047fd1f_labels",
 *             "audienceProviderData": {
 *               "labelIds": ["custom.vip"]
 *             }
 *           }
 *         ]
 *       }
 *     }
 *   }
 * }
 */

```

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

---