> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Package: emails

# Namespace: emailTransmissionV1

# Webhook link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-transmission-v1/email-transmission-created.md

# Webhook Permissions Scopes IDs:
Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING

## Introduction

Triggered when an email transmission is created.

---

## REST API

### Schema

```
Webhook: Email Transmission Created
Description: Triggered when an email transmission is created.
Event body:
 - name: id | type: string | description: Unique event ID. Allows clients to ignore duplicate events.
 - name: entityFqdn | type: string | description: Fully qualified domain name of the entity associated with the event.
 - name: slug | type: string | description: Event name.
 - name: entityId | type: string | description: ID of the entity associated with the event.
 - name: eventTime | type: string (date-time) | description: Event timestamp.
 - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application such as GDPR.
 - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
 - name: createdEvent | type: object | description: Created event details.
    - name: entity | type: EmailTransmission | description: The created entity.
        - ONE-OF:
           - name: marketingOptions | type: MarketingOptions | description: Options for marketing emails.  Used only when `type` is `MARKETING`.
              - name: unsubscribeUrlPlaceholder | type: string | description: Placeholder in `emailHtmlContent` that gets replaced with a recipient-specific unsubscribe URL before the email is sent. Case-sensitive. For example, `{{unsubscribe_url}}` or `[UNSUBSCRIBE_URL]`. The placeholder must be unique within the HTML content.  If not set, an unsubscribe link in the site's default language is appended to the bottom of the email.
        - name: id | type: string | description: Email transmission GUID.
        - name: createdDate | type: string | description: Date and time the email transmission was created.
        - name: updatedDate | type: string | description: Date and time the email transmission was last updated.
        - name: revision | type: string | description: Revision number, which increments by 1 each time the email transmission is updated.
        - name: emailSubject | type: string | description: Subject line of the email.
        - name: emailHtmlContent | type: string | description: Full HTML content of the email.  Not returned in `queryEmailTransmissions`. Use `getEmailTransmission` to retrieve the HTML content of a specific transmission.  Stored for 30 days after the transmission is created. After that, this field returns `"<expired>"`.
        - name: metadata | type: object | description: Custom key-value pairs attached to the transmission to identify the context in which the email was sent. These values are passed to the email service provider and included in domain event payloads. Keys and values support letters, numbers, and hyphens only (no spaces or other special characters). Length of keys and values must be between 1 and 50 characters.  Default: `{}`
        - name: senderName | type: string | description: Display name shown as the sender.  Default: None (no display name is set).
        - name: senderEmailAddress | type: string | description: Sender email address. Must be verified using the Sender Emails API before use.  If the provided address can't be used as a FROM address (for example, addresses from free email providers such as gmail.com), the email is sent from `no-reply@et.wixsitemail.com` and the provided address is automatically used as the reply-to address instead.  Default: `no-reply@et.wixsitemail.com`
        - name: replyTo | type: Recipient | description: Recipient that receives replies to this email. When a recipient replies, the reply is directed to this address instead of the sender address.  Default: When `senderEmailAddress` is provided and the email is sent from the Wix shared sender address, replies are automatically directed to `senderEmailAddress`.
           - ONE-OF:
              - name: contactId | type: string | description: GUID of the contact to send the email to. The contact's email address is retrieved from the Contacts API.
              - name: userId | type: string | description: GUID of the Wix user to send the email to. The user must be a site collaborator.  The user's email address is retrieved from the Users API.
              - name: emailAddress | type: string | description: Email address to send the email to. A contact is created with this address if one doesn't already exist.
           - name: id | type: string | description: Recipient GUID. Auto-generated value that uniquely identifies the recipient in the email transmission.
           - name: name | type: string | description: Display name of the recipient.
           - name: status | type: RecipientStatus | description: Status of this particular recipient.
               - enum:
               -     PENDING: Recipient is still waiting to be processed.
               -     SENT: Email for this recipient was sent (it's not the same as "delivered" because it can still bounce).
               -     FAILED: Recipient was excluded (see "failureReason" for more details).
           - name: failureReason | type: FailureReason | description: Reason why the email couldn't be delivered to this recipient. `NONE` means the email was successfully sent.  Returned once the transmission reaches `PROCESSED` or `ABORTED` status.
               - enum:
               -     NONE: Email was successfully sent to this recipient.
               -     RECIPIENT_NOT_FOUND: Contact or user wasn't found by the provided ID.
               -     EMAIL_ADDRESS_MISSING: Contact or user doesn't have an email address.
               -     EMAIL_ADDRESS_INVALID: Email address doesn't exist or is invalid.
               -     EMAIL_ADDRESS_BOUNCED: Email address has previously bounced and can't be sent to.
               -     MARKETING_CONSENT_NOT_GIVEN: Recipient hasn't given consent to receive marketing emails.
               -     NOT_SITE_COLLABORATOR: User isn't a collaborator on this site. Only site collaborators can be specified as recipients by user ID.
        - name: toRecipients | type: array<Recipient> | description: List of recipients the email is sent to.
        - name: type | type: Type | description: Email type.
           - enum:
           -     TRANSACTIONAL: Email triggered by a specific action, such as an order confirmation or booking reminder. No unsubscribe link is added.
           -     MARKETING: Email sent to multiple recipients as part of a campaign, such as a newsletter or promotion. An unsubscribe link is automatically added.
        - name: status | type: Status | description: Current status of the email transmission.
           - enum:
           -     ACCEPTED: Email transmission was accepted and is queued for processing.
           -     IN_PROGRESS: Email transmission is being processed - the content is being checked, attachments are being prepared, recipients are being resolved, emails are being sent.
           -     PROCESSED: Email transmission has been fully processed. At least one email was sent. See `toRecipients` for per-recipient delivery information.
           -     REJECTED: Email transmission was not sent because it failed an abuse check. No emails were sent. See `rejectedOptions` for details.
           -     ABORTED: Email transmission was not sent because attachments couldn't be attached or zero valid recipients were found. No emails were sent. See `abortedOptions` for details.
        - name: customHeaders | type: object | description: Custom headers to include in the email. Keys should have max length of 64 and must start with a letter and contain only letters, digits and hyphens. Keys are case insensitive and must be unique (for example, "X-Foo" and "x-foo" cannot both be provided). Values should have max length of 900 and must contain only printable ASCII characters (0x20-0x7E). The keys should not contain reserved headers (case insensitive) from this list: * BCC * CC * Content-Type * Content-Transfer-Encoding * DKIM-Signature * Feedback-GUID * From * Precedence * Received * Reply-To * Return-Path * Sender * Subject * To * X-Abuse-Id If provided header happens to be also set by the system internally (for example "List-Unsubscribe"), provided header value will then be overridden.
        - name: emailTextContent | type: string | description: Plain text content of the email (optional).  Not returned in `queryEmailTransmissions`. Use `getEmailTransmission` to retrieve the text content of a specific transmission.  Stored for 30 days after the transmission is created. After that, this field returns `"<expired>"`.
        - name: attachments | type: array<Attachment> | description: Email attachments. Total size for all attachments must not exceed 20 MB when base64-encoded. Emails are either sent with all attachments or not sent at all. If any attachment fails to process, email transmission status is set to `ABORTED`.  Attachments are available to download for 30 days.
           - ONE-OF:
              - name: remote | type: RemoteFile | description: Remote file that will be downloaded from provided URL once.
                 - name: fetchUrl | type: string | description: File download URL. It must be publicly accessible without authentication and stay valid until status has changed to `PROCESSED`. Download must finish in less than 30 seconds, max supported file size is 10 MB after base64 encoding.
              - name: local | type: LocalFile | description: Base64-encoded content of the local file.
                 - name: contentBase64 | type: string | description: Base64-encoded content of the attachment file. This field is not returned in `getEmailTransmission`, `queryEmailTransmissions` nor domain events.
           - name: fileName | type: string | description: Name of the attached file. Following extensions are not supported: "adp", "apk", "app", "asp", "bas", "bat", "cmd", "com", "cpl", "dll", "exe", "fxp", "gadget", "hta", "inf", "ins", "isp", "jar", "js", "jse", "ksh", "mar", "msi", "msp", "prf", "prg", "ps1", "reg", "scf", "scr", "sct", "sys", "url", "vb", "vbe", "vbs", "vsmacros", "ws", "wsc", "wsf".
           - name: contentType | type: string | description: MIME type of the attached file (optional). If not provided, the MIME type will be inferred on best effort.
           - name: metadata | type: AttachmentMetadata | description: Metadata about the attachment.
              - name: sizeBytes | type: integer | description: Size of the attached file in bytes.
              - name: downloadUrl | type: string | description: URL to download the attached file. The file is available for 30 days after the transmission is created.

```

---

## JavaScript SDK

### Schema

```
Webhook: onEmailTransmissionCreated
Description: Triggered when an email transmission is created.
Payload: EmailTransmissionCreatedEnvelope
  - name: entity | type: EmailTransmission | description: none
     - ONE-OF:
        - name: marketingOptions | type: MarketingOptions | description: Options for marketing emails.  Used only when `type` is `MARKETING`.
           - name: unsubscribeUrlPlaceholder | type: string | description: Placeholder in `emailHtmlContent` that gets replaced with a recipient-specific unsubscribe URL before the email is sent. Case-sensitive. For example, `{{unsubscribe_url}}` or `[UNSUBSCRIBE_URL]`. The placeholder must be unique within the HTML content.  If not set, an unsubscribe link in the site's default language is appended to the bottom of the email.
     - name: _id | type: string | description: Email transmission GUID.
     - name: _createdDate | type: Date | description: Date and time the email transmission was created.
     - name: _updatedDate | type: Date | description: Date and time the email transmission was last updated.
     - name: revision | type: string | description: Revision number, which increments by 1 each time the email transmission is updated.
     - name: emailSubject | type: string | description: Subject line of the email.
     - name: emailHtmlContent | type: string | description: Full HTML content of the email.  Not returned in `queryEmailTransmissions`. Use `getEmailTransmission` to retrieve the HTML content of a specific transmission.  Stored for 30 days after the transmission is created. After that, this field returns `"<expired>"`.
     - name: metadata | type: object | description: Custom key-value pairs attached to the transmission to identify the context in which the email was sent. These values are passed to the email service provider and included in domain event payloads. Keys and values support letters, numbers, and hyphens only (no spaces or other special characters). Length of keys and values must be between 1 and 50 characters.  Default: `{}`
     - name: senderName | type: string | description: Display name shown as the sender.  Default: None (no display name is set).
     - name: senderEmailAddress | type: string | description: Sender email address. Must be verified using the Sender Emails API before use.  If the provided address can't be used as a FROM address (for example, addresses from free email providers such as gmail.com), the email is sent from `no-reply@et.wixsitemail.com` and the provided address is automatically used as the reply-to address instead.  Default: `no-reply@et.wixsitemail.com`
     - name: replyTo | type: Recipient | description: Recipient that receives replies to this email. When a recipient replies, the reply is directed to this address instead of the sender address.  Default: When `senderEmailAddress` is provided and the email is sent from the Wix shared sender address, replies are automatically directed to `senderEmailAddress`.
        - ONE-OF:
           - name: contactId | type: string | description: GUID of the contact to send the email to. The contact's email address is retrieved from the Contacts API.
           - name: userId | type: string | description: GUID of the Wix user to send the email to. The user must be a site collaborator.  The user's email address is retrieved from the Users API.
           - name: emailAddress | type: string | description: Email address to send the email to. A contact is created with this address if one doesn't already exist.
        - name: _id | type: string | description: Recipient GUID. Auto-generated value that uniquely identifies the recipient in the email transmission.
        - name: name | type: string | description: Display name of the recipient.
        - name: status | type: RecipientStatus | description: Status of this particular recipient.
             - enum:
             -     PENDING: Recipient is still waiting to be processed.
             -     SENT: Email for this recipient was sent (it's not the same as "delivered" because it can still bounce).
             -     FAILED: Recipient was excluded (see "failureReason" for more details).
        - name: failureReason | type: FailureReason | description: Reason why the email couldn't be delivered to this recipient. `NONE` means the email was successfully sent.  Returned once the transmission reaches `PROCESSED` or `ABORTED` status.
             - enum:
             -     NONE: Email was successfully sent to this recipient.
             -     RECIPIENT_NOT_FOUND: Contact or user wasn't found by the provided ID.
             -     EMAIL_ADDRESS_MISSING: Contact or user doesn't have an email address.
             -     EMAIL_ADDRESS_INVALID: Email address doesn't exist or is invalid.
             -     EMAIL_ADDRESS_BOUNCED: Email address has previously bounced and can't be sent to.
             -     MARKETING_CONSENT_NOT_GIVEN: Recipient hasn't given consent to receive marketing emails.
             -     NOT_SITE_COLLABORATOR: User isn't a collaborator on this site. Only site collaborators can be specified as recipients by user ID.
     - name: toRecipients | type: array<Recipient> | description: List of recipients the email is sent to.
     - name: type | type: Type | description: Email type.
         - enum:
         -     TRANSACTIONAL: Email triggered by a specific action, such as an order confirmation or booking reminder. No unsubscribe link is added.
         -     MARKETING: Email sent to multiple recipients as part of a campaign, such as a newsletter or promotion. An unsubscribe link is automatically added.
     - name: status | type: Status | description: Current status of the email transmission.
         - enum:
         -     ACCEPTED: Email transmission was accepted and is queued for processing.
         -     IN_PROGRESS: Email transmission is being processed - the content is being checked, attachments are being prepared, recipients are being resolved, emails are being sent.
         -     PROCESSED: Email transmission has been fully processed. At least one email was sent. See `toRecipients` for per-recipient delivery information.
         -     REJECTED: Email transmission was not sent because it failed an abuse check. No emails were sent. See `rejectedOptions` for details.
         -     ABORTED: Email transmission was not sent because attachments couldn't be attached or zero valid recipients were found. No emails were sent. See `abortedOptions` for details.
     - name: customHeaders | type: object | description: Custom headers to include in the email. Keys should have max length of 64 and must start with a letter and contain only letters, digits and hyphens. Keys are case insensitive and must be unique (for example, "X-Foo" and "x-foo" cannot both be provided). Values should have max length of 900 and must contain only printable ASCII characters (0x20-0x7E). The keys should not contain reserved headers (case insensitive) from this list: * BCC * CC * Content-Type * Content-Transfer-Encoding * DKIM-Signature * Feedback-GUID * From * Precedence * Received * Reply-To * Return-Path * Sender * Subject * To * X-Abuse-Id If provided header happens to be also set by the system internally (for example "List-Unsubscribe"), provided header value will then be overridden.
     - name: emailTextContent | type: string | description: Plain text content of the email (optional).  Not returned in `queryEmailTransmissions`. Use `getEmailTransmission` to retrieve the text content of a specific transmission.  Stored for 30 days after the transmission is created. After that, this field returns `"<expired>"`.
     - name: attachments | type: array<Attachment> | description: Email attachments. Total size for all attachments must not exceed 20 MB when base64-encoded. Emails are either sent with all attachments or not sent at all. If any attachment fails to process, email transmission status is set to `ABORTED`.  Attachments are available to download for 30 days.
        - ONE-OF:
           - name: remote | type: RemoteFile | description: Remote file that will be downloaded from provided URL once.
              - name: fetchUrl | type: string | description: File download URL. It must be publicly accessible without authentication and stay valid until status has changed to `PROCESSED`. Download must finish in less than 30 seconds, max supported file size is 10 MB after base64 encoding.
           - name: local | type: LocalFile | description: Base64-encoded content of the local file.
              - name: contentBase64 | type: string | description: Base64-encoded content of the attachment file. This field is not returned in `getEmailTransmission`, `queryEmailTransmissions` nor domain events.
        - name: fileName | type: string | description: Name of the attached file. Following extensions are not supported: "adp", "apk", "app", "asp", "bas", "bat", "cmd", "com", "cpl", "dll", "exe", "fxp", "gadget", "hta", "inf", "ins", "isp", "jar", "js", "jse", "ksh", "mar", "msi", "msp", "prf", "prg", "ps1", "reg", "scf", "scr", "sct", "sys", "url", "vb", "vbe", "vbs", "vsmacros", "ws", "wsc", "wsf".
        - name: contentType | type: string | description: MIME type of the attached file (optional). If not provided, the MIME type will be inferred on best effort.
        - name: metadata | type: AttachmentMetadata | description: Metadata about the attachment.
           - name: sizeBytes | type: integer | description: Size of the attached file in bytes.
           - name: downloadUrl | type: string | description: URL to download the attached file. The file is available for 30 days after the transmission is created.
  - name: metadata | type: EventMetadata | description: none
     - name: instanceId | type: string | description: App instance GUID.
     - name: eventType | type: string | description: Event type.
     - name: identity | type: IdentificationData | description: The identification type and identity data.
        - ONE-OF:
           - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
           - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
           - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
           - name: appId | type: string | description: GUID of an app.
        - name: identityType | type: WebhookIdentityType | description: 
             - enum: UNKNOWN, ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
     - name: accountInfo | type: AccountInfo | description: Details related to the account
        - name: accountId | type: string | description: GUID of the Wix account associated with the event.
        - name: parentAccountId | type: string | description: GUID of the parent Wix account. Only included when accountId belongs to a child account.
        - name: siteId | type: string | description: GUID of the Wix site associated with the event. Only included when the event is tied to a specific site.
     - name: _id | type: string | description: Event GUID. With this GUID you can easily spot duplicated events and ignore them.
     - name: entityFqdn | type: string | description: Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
     - name: slug | type: string | description: Event action name, placed at the top level to make it easier for users to dispatch messages. For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
     - name: entityId | type: string | description: GUID of the entity associated with the event.
     - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`.
     - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
     - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
     - name: entityEventSequence | type: string | description: A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.

```

### Examples


```javascript
import { emailTransmissions } from '@wix/email-transmissions';

emailTransmissions.onEmailTransmissionCreated((event) => {
    // handle your event here
});
```


```javascript
import { createClient, AppStrategy } from '@wix/sdk';
import { emailTransmissions } from '@wix/email-transmissions';

const wixClient = createClient({
  auth: AppStrategy({
    appId: 'MY-APP-ID',
    publicKey: 'YOUR_APP_PUBLIC_KEY',
  }),
  modules: {
      emailTransmissions,
    },
});

wixClient.emailTransmissions.onEmailTransmissionCreated((event) => {
    // handle your event here
});
```

---