> 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 # ValidateConfiguration # Package: triggers # Namespace: TriggerProviderService # Method link: https://dev.wix.com/docs/api-reference/business-management/automations/triggers/trigger-provider-service-plugin/validate-configuration.md ## Introduction This endpoint allows you to run your own logic to validate trigger fields. Implement this endpoint if you need to perform extra validation on top of the Wix validation process. Wix calls Validate Configuration in the following cases: - When a Wix user activates the automation. - When a Wix user selects the automation from the **Your automations** list in the [**Automations**](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Ftriggers/site-automations) dashboard. - When a Wix user opens the automation to edit it. If the user configured filters when setting up their automation, these are included in the request. Wix uses the returned response to display an error message to a user if the requested trigger is invalid. --- ## REST API ### Schema ``` Method: validateConfiguration Description: This endpoint allows you to run your own logic to validate trigger fields. Implement this endpoint if you need to perform extra validation on top of the Wix validation process. Wix calls Validate Configuration in the following cases: - When a Wix user activates the automation. - When a Wix user selects the automation from the **Your automations** list in the [**Automations**](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Ftriggers/site-automations) dashboard. - When a Wix user opens the automation to edit it. If the user configured filters when setting up their automation, these are included in the request. Wix uses the returned response to display an error message to a user if the requested trigger is invalid. URL: null 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: automationConfigMapping | type: automationConfigMapping | description: Trigger configuration mapping that's saved on the automation. param name: selectedFilterOptions | type: array | description: Current selection state of the trigger's filters. - name: fieldKey | type: string | description: Key representing a field from the trigger's [payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md) that has been configured as an [item selection filter](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/triggers/filter-fields.md#item-selection). For example `formId`. - name: values | type: array | description: Values selected for the filter field. 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: ValidateConfigurationResponse - name: valid | type: boolean | description: Whether the trigger configuration is valid. - name: configurationErrors | type: array | description: Error details for an invalid trigger configuration. - name: fieldKey | type: string | description: Scheme field key. - name: message | type: string | description: Error message. - name: ctaLabel | type: string | description: Label for the call-to-action button displayed with the error. - name: ctaUrl | type: string | description: When the call-to-action button is clicked, the redirect URL. - name: title | type: string | description: Error title. Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: PROVIDER_NOT_FOUND | Description: Service provider not found. ``` ### Examples ### Validate configuration request sent by Wix A validate configuration request with a sample invalid response body ```curl curl -X POST \ 'https://www..com/validate-configuration' \ -H 'user-agent: Wix' \ -H 'accept-encoding: gzip, deflate' \ -H 'content-type: text/plain; charset=utf-8' \ -d '{ "triggerKey": "product-purchased", "selectedFilterOptions": [ { "fieldKey": "product_id", "values": ["13453-w33e"] }, { "fieldKey": "variant_id", "values": ["9376asd-s3bg"] }, ] }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.triggers.TriggerProviderService.validateConfiguration(request, metadata) Description: This endpoint allows you to run your own logic to validate trigger fields. Implement this endpoint if you need to perform extra validation on top of the Wix validation process. Wix calls Validate Configuration in the following cases: - When a Wix user activates the automation. - When a Wix user selects the automation from the **Your automations** list in the [**Automations**](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Ftriggers/site-automations) dashboard. - When a Wix user opens the automation to edit it. If the user configured filters when setting up their automation, these are included in the request. Wix uses the returned response to display an error message to a user if the requested trigger is invalid. Method parameters: param name: metadata | type: Context | description: this message is not directly used by any service, it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform. e.g. SPIs, event-handlers, etc.. NOTE: this context object MUST be provided as the last argument in each Velo method signature. Example: ```typescript export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) { ... } ``` - name: requestId | type: string | description: A unique identifier of the request. You may print this GUID to your logs to help with future debugging and easier correlation with Wix's logs. - name: currency | type: string | description: [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code. - name: identity | type: IdentificationData | description: An object that describes the identity that triggered this request. - 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: languages | type: array | description: A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`. - name: instanceId | type: string | description: The service provider app's instance GUID. param name: request | type: ValidateConfigurationRequest - 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`. - name: selectedFilterOptions | type: array | description: Current selection state of the trigger's filters. - name: fieldKey | type: string | description: Key representing a field from the trigger's [payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md) that has been configured as an [item selection filter](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/triggers/filter-fields.md#item-selection). For example `formId`. - name: values | type: array | description: Values selected for the filter field. - name: automationConfigMapping | type: object | description: Trigger configuration mapping that's saved on the automation. Return type: PROMISE - name: valid | type: boolean | description: Whether the trigger configuration is valid. - name: configurationErrors | type: array | description: Error details for an invalid trigger configuration. - name: fieldKey | type: string | description: Scheme field key. - name: message | type: string | description: Error message. - name: ctaLabel | type: string | description: Label for the call-to-action button displayed with the error. - name: ctaUrl | type: string | description: When the call-to-action button is clicked, the redirect URL. - name: title | type: string | description: Error title. Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: PROVIDER_NOT_FOUND | Description: Service provider not found. ``` ### Examples ### validateConfiguration ```javascript import { triggerProvider } from '@wix/automations/service-plugins'; async function validateConfiguration(request,metadata) { const response = await triggerProvider.validateConfiguration(request,metadata); }; ``` ### validateConfiguration (with elevated permissions) ```javascript import { triggerProvider } from '@wix/automations/service-plugins'; import { auth } from '@wix/essentials'; async function myValidateConfigurationMethod(request,metadata) { const elevatedValidateConfiguration = auth.elevate(triggerProvider.validateConfiguration); const response = await elevatedValidateConfiguration(request,metadata); } ``` ### validateConfiguration (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 { triggerProvider } from '@wix/automations/service-plugins'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { triggerProvider }, // Include the auth strategy and host as relevant }); async function validateConfiguration(request,metadata) { const response = await myWixClient.triggerProvider.validateConfiguration(request,metadata); }; ``` ---