> 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

# ReportEvent

# Package: triggers

# Namespace: EsbConfigResolver

# Method link: https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/report-event?apiView=SDK.md

## Permission Scopes:
Set Up Automations: SCOPE.CRM.SETUP-AUTOMATIONS

## Introduction

Reports an event and activates site automations with the specified trigger key.


Only the app that created a trigger can report events for it.
This means other apps can't report events for your triggers,
and you can't report events for another app's triggers.

If your app supports canceling events,
`externalEntityId` must be provided.
`externalEntityId` is required when calling [Cancel Event](https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/cancel-event.md).

The event is processed asynchronously. A successful response means the event was accepted for processing, not that the automations have finished running.

To report multiple events in a single call, call [Bulk Report Event](https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/bulk-report-event.md).

> You cannot try out this endpoint because
> it can be called only by the app that created the specified `triggerKey`.
> So please ignore the **Try It Out** button.

---

## REST API

### Schema

```
 Method: reportEvent
 Description: Reports an event and activates site automations with the specified trigger key.   Only the app that created a trigger can report events for it. This means other apps can't report events for your triggers, and you can't report events for another app's triggers.  If your app supports canceling events, `externalEntityId` must be provided. `externalEntityId` is required when calling [Cancel Event](https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/cancel-event.md).  The event is processed asynchronously. A successful response means the event was accepted for processing, not that the automations have finished running.  To report multiple events in a single call, call [Bulk Report Event](https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/bulk-report-event.md).  > You cannot try out this endpoint because > it can be called only by the app that created the specified `triggerKey`. > So please ignore the **Try It Out** button.
 URL: https://www.wixapis.com/automations/v1/events/report
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  triggerKey
 Method parameters: 
   param name: externalEntityId | type: externalEntityId | description: GUID of the related resource in GUGUID format. For example, `fc81a355-3429-50fc-a4c7-def486e828f3`.  Required if your app needs to [cancel the event](https://dev.wix.com/docs/rest/business-management/automations/triggered-events/cancel-event.md) if the automation becomes no longer relevant.  Typically, this GUID is defined in your system, but you can also use any Wix resource GUID, such as contact GUID, member GUID, or invoice GUID. See [Choose the right `externalEntityId`](https://dev.wix.com/docs/rest/business-management/automations/triggered-events/reporting-and-canceling-events.md#about-canceling-events) for more information.  | validation: format GUID
   param name: idempotency | type: Idempotency    
        - name: key | type: string | description: A unique identifier for the event. If you send the same idempotency key in multiple report event requests, for the same trigger key and app id, consecutive requests will be ignored after the first one. Note that the idempotency key is kept for a week before it expires.  | validation: minLength 1, maxLength 80
        - name: ttlInMilliseconds | type: string | description: Optional. The time to live (TTL) in milliseconds before the key will expire. Default is a week.  | validation: minimum 1, format int64
   param name: payload | type: payload | description: Event payload, formatted as key:value pairs. Must comply with the payload schema if you provided one when configuring your trigger.  Key names can include only alphanumeric characters or underscores (`A-Z`, `a-z`, `0-9`, `_`). They cannot start with an underscore.  Values can be strings, numbers, integers, booleans, or arrays. If a value is an array, the array items must be objects, and nested object properties must be strings, numbers, integers, or booleans only.  
   param name: triggerKey | type: triggerKey | description: Trigger key as defined in your app's trigger configuration in the app dashboard. For example, `form_submitted` or `invoice_due`. | required: true | validation: minLength 1, maxLength 100
 Return type: ReportEventResponse

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REQUIRED_PROPERTY | Description: A required property is missing from the request.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SCHEMA_VALIDATION_FAILED | Description: The event payload doesn't match the trigger's payload schema.


```

### Examples

### ReportEvent
```curl
~~~cURL
curl -X POST https://www.wixapis.com/automations/v1/events/report  \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Authorization: <AUTH>' \
  -d '{
    "triggerKey": "my_trigger",
    "payload": {
      "name": "John Doe"
    },
    "externalEntityId": "16ef8c9c-413e-4d5f-b77d-8c67c3c8ae0c"
  }'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automations.activations.reportEvent(triggerKey, options)
 Description: Reports an event and activates site automations with the specified trigger key.   Only the app that created a trigger can report events for it. This means other apps can't report events for your triggers, and you can't report events for another app's triggers.  If your app supports canceling events, `externalEntityId` must be provided. `externalEntityId` is required when calling [Cancel Event](https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/cancel-event.md).  The event is processed asynchronously. A successful response means the event was accepted for processing, not that the automations have finished running.  To report multiple events in a single call, call [Bulk Report Event](https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/bulk-report-event.md).  > You cannot try out this endpoint because > it can be called only by the app that created the specified `triggerKey`. > So please ignore the **Try It Out** button.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  triggerKey
 Method parameters: 
   param name: triggerKey | type: string | description: Trigger key as defined in your app's trigger configuration in the app dashboard. For example, `form_submitted` or `invoice_due`. | required: true | validation: minLength 1, maxLength 100
   param name: options | type: ReportEventOptions  none  
        - name: payload | type: object | description: Event payload, formatted as key:value pairs. Must comply with the payload schema if you provided one when configuring your trigger.  Key names can include only alphanumeric characters or underscores (`A-Z`, `a-z`, `0-9`, `_`). They cannot start with an underscore.  Values can be strings, numbers, integers, booleans, or arrays. If a value is an array, the array items must be objects, and nested object properties must be strings, numbers, integers, or booleans only.  
        - name: externalEntityId | type: string | description: GUID of the related resource in GUGUID format. For example, `fc81a355-3429-50fc-a4c7-def486e828f3`.  Required if your app needs to [cancel the event](https://dev.wix.com/docs/rest/business-management/automations/triggered-events/cancel-event.md) if the automation becomes no longer relevant.  Typically, this GUID is defined in your system, but you can also use any Wix resource GUID, such as contact GUID, member GUID, or invoice GUID. See [Choose the right `externalEntityId`](https://dev.wix.com/docs/rest/business-management/automations/triggered-events/reporting-and-canceling-events.md#about-canceling-events) for more information.  | validation: format GUID
        - name: idempotency | type: Idempotency | description: Idempotency information for the event.  
           - name: key | type: string | description: A unique identifier for the event. If you send the same idempotency key in multiple report event requests, for the same trigger key and app id, consecutive requests will be ignored after the first one. Note that the idempotency key is kept for a week before it expires.  | validation: minLength 1, maxLength 80
           - name: ttlInMilliseconds | type: string | description: Optional. The time to live (TTL) in milliseconds before the key will expire. Default is a week.  | validation: minimum 1, format int64
 Return type: PROMISE<ReportEventResponse>

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REQUIRED_PROPERTY | Description: A required property is missing from the request.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SCHEMA_VALIDATION_FAILED | Description: The event payload doesn't match the trigger's payload schema.


```

### Examples

### reportEvent
```javascript
import { activations } from '@wix/automations';

async function reportEvent(triggerKey,options) {
  const response = await activations.reportEvent(triggerKey,options);
};
```

### reportEvent (with elevated permissions)
```javascript
import { activations } from '@wix/automations';
import { auth } from '@wix/essentials';

async function myReportEventMethod(triggerKey,options) {
  const elevatedReportEvent = auth.elevate(activations.reportEvent);
  const response = await elevatedReportEvent(triggerKey,options);
}
```

### reportEvent (self-managed)
Self-managed 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 { activations } from '@wix/automations';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function reportEvent(triggerKey,options) {
  const response = await myWixClient.activations.reportEvent(triggerKey,options);
};
```

---