> 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 # sendBIEvent # Package: biEvent # Namespace: BIEventsService # Method link: https://dev.wix.com/docs/api-reference/app-management/bi-event/send-bi-event.md ## Permission Scopes: Manage Your App: SCOPE.DC.MANAGE-YOUR-APP ## Introduction Submit a BI event to Wix. --- ## REST API ### Schema ``` Method: sendBiEvent Description: Submit a BI event to Wix. URL: https://www.wixapis.com/v1/bi-event Method: POST Method parameters: param name: customEventName | type: customEventName | description: Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`. Min: 2 characters param name: eventData | type: eventData | description: Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`. You may also submit data with keys that aren't listed here. Additional data about your app's event. + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`. + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`. + `"reason"`: Information about why the event was triggered in your app. + `"app_plan_id"`: GUID of the your app's plan as displayed in your app's dashboard. Note that it's the same value as `vendorProductId` in the [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/app-management/app-instance/paid-plan-purchased.md). - name: key | type: string | description: none - name: value | type: string | description: none param name: eventName | type: EventName - enum: UNKNOWN - Unknown event name. APP_DASHBOARD_LOADED - A Wix user loads your app's dashboard. APP_FINISHED_CONFIGURATION - The Wix user completes all required configurations for your app in your app's dashboard. APP_UPGRADED - The Wix user upgrades your app's paid plan. An upgrade means that they have finished the checkout flow on the app's side but not necessarily on Wix's side. PRIMARY_ACTION_PERFORMED - A site owner, contributor, or visitor triggers your app's primary action. For example, a site visitor writes a product review using your product review app. CUSTOM - Any event that's not listed here. Make sure to also send `customEventName`. CHARGE - You charge money from the Wix user. For example, when the Wix user purchases or renews a subscription for your app. Make sure to also send `eventData` and a key of `sum`. FUNDS_RETURNED - Trigger this event when you send money back to a Wix user (for example, refunds or chargebacks). Make sure to also send the charge amount inside `eventData`. For example, `{"eventData": {"sum": "5.99"}}`. APP_FINISH_BUSINESS_SETUP - __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead. APP_DEPLOYED - Your app’s internal code implementation is changed and might affect user flows or cause a regression. APP_SETUP_FINISHED - The Wix user completes your app's required business setup, including in the dashboard and editor. Return type: SendBIEventResponse EMPTY-OBJECT {} ``` ### Examples ### Log-in Completed ```curl curl -X POST \ https://www.wixapis.com/apps/v1/bi-event \ -H 'Authorization: ' \ -d '{ "eventName": "CUSTOM", "customEventName': "Log_in_completed", }' ``` ### sendBIEvent ```curl ~~~cURL curl -X POST \ https://www.wixapis.com/apps/v1/bi-event \ -H 'Authorization: ' \ -d '{ "eventName": "CUSTOM", "customEventName": "Contact form submitted", "eventData": { "User name": "John Doe", "Title": "Need help with the app", "Description": "I have run into a little bit of an issue with my app" }' ~~~ ``` ### First Success ```curl curl -X POST \ 2 https://www.wixapis.com/apps/v1/bi-event \ 3 -H 'Authorization: ' \ 4 -d '{ 5 "eventName": "PRIMARY_ACTION_PERFORMED", 6 }' ``` ### App Upgraded ```curl curl -X POST \ https://www.wixapis.com/apps/v1/bi-event \ -H 'Authorization: ' \ -d '{ "eventName": "APP_UPGRADED", "eventData": { "cycle_name": "yearly", "currency": "usd", "sum": "10", "reason": "upgrade", "app_plan_id" : "pro", ``` ### Complete Setup ```curl curl -X POST \ https://www.wixapis.com/apps/v1/bi-event \ -H 'Authorization: ' \ -d '{ "eventName": "APP_FINISHED_CONFIGURATION", }' ``` ### App Dashboard Loaded ```curl curl -X POST \ 2 https://www.wixapis.com/apps/v1/bi-event \ 3 -H 'Authorization: ' \ 4 -d '{ 5 "eventName": "APP_DASHBOARD_LOADED", 6 }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.biEvent.BIEventsService.sendBiEvent(options) Description: Submit a BI event to Wix. Method parameters: param name: options | type: sendBIEventOptions none - name: eventName | type: EventName | description: Name of the event that's triggered in your app. - enum: - UNKNOWN: Unknown event name. - APP_DASHBOARD_LOADED: A Wix user loads your app's dashboard. - APP_FINISHED_CONFIGURATION: The Wix user completes all required configurations for your app in your app's dashboard. - APP_UPGRADED: The Wix user upgrades your app's paid plan. An upgrade means that they have finished the checkout flow on the app's side but not necessarily on Wix's side. - PRIMARY_ACTION_PERFORMED: A site owner, contributor, or visitor triggers your app's primary action. For example, a site visitor writes a product review using your product review app. - CUSTOM: Any event that's not listed here. Make sure to also send `customEventName`. - CHARGE: You charge money from the Wix user. For example, when the Wix user purchases or renews a subscription for your app. Make sure to also send `eventData` and a key of `sum`. - FUNDS_RETURNED: Trigger this event when you send money back to a Wix user (for example, refunds or chargebacks). Make sure to also send the charge amount inside `eventData`. For example, `{"eventData": {"sum": "5.99"}}`. - APP_FINISH_BUSINESS_SETUP: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead. - APP_DEPLOYED: Your app’s internal code implementation is changed and might affect user flows or cause a regression. - APP_SETUP_FINISHED: The Wix user completes your app's required business setup, including in the dashboard and editor. - name: customEventName | type: string | description: Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`. Min: 2 characters - name: eventData | type: object | description: Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`. You may also submit data with keys that aren't listed here. Additional data about your app's event. + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`. + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`. + `"reason"`: Information about why the event was triggered in your app. + `"app_plan_id"`: GUID of the your app's plan as displayed in your app's dashboard. Note that it's the same value as `vendorProductId` in the [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/app-management/app-instance/paid-plan-purchased.md). Return type: PROMISE EMPTY-OBJECT {} ``` ### Examples ### sendBiEvent ```javascript import { biEvents } from '@wix/app-management'; async function sendBiEvent(options) { const response = await biEvents.sendBiEvent(options); }; ``` ### sendBiEvent (with elevated permissions) ```javascript import { biEvents } from '@wix/app-management'; import { auth } from '@wix/essentials'; async function mySendBiEventMethod(options) { const elevatedSendBiEvent = auth.elevate(biEvents.sendBiEvent); const response = await elevatedSendBiEvent(options); } ``` ### sendBiEvent (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 { biEvents } from '@wix/app-management'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { biEvents }, // Include the auth strategy and host as relevant }); async function sendBiEvent(options) { const response = await myWixClient.biEvents.sendBiEvent(options); }; ``` ---