> 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 # ReportEvent # Package: triggers # Namespace: EsbConfigResolver # Method link: https://dev.wix.com/docs/api-reference/business-management/automations/triggers/triggered-events/report-event.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](#cancel-event). > 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](#cancel-event). > 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. 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. - name: ttlInMilliseconds | type: string | description: Optional. The time to live (TTL) in milliseconds before the key will expire. Default is a week. 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 Return type: ReportEventResponse Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REQUIRED_PROPERTY | Description: Missing request payload. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SCHEMA_VALIDATION_FAILED | Description: Schema validation failed. ``` ### Examples ### ReportEvent ```curl ~~~cURL curl POST https://www.wixapis.com/automations/v1/events/report \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: ' \ -d '{ "triggerKey": "my_trigger", "payload": { "name": "John Doe" }, "externalEntityId": "16ef8c9c-413e-4d5f-b77d-8c67c3c8ae0c" }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.triggers.EsbConfigResolver.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](#cancel-event). > 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: 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. - 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. - name: ttlInMilliseconds | type: string | description: Optional. The time to live (TTL) in milliseconds before the key will expire. Default is a week. 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 Return type: PROMISE Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REQUIRED_PROPERTY | Description: Missing request payload. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SCHEMA_VALIDATION_FAILED | Description: Schema validation failed. ``` ### 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-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 { 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); }; ``` ---