> 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: actions # Namespace: ActionProviderService # Method link: https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md ## Introduction This method is used to validate a Wix user's action configuration. Wix calls this method when a Wix user configures an automation with your action, and when they select the automation from the **Your automations** list in the **Automations** dashboard. Wix uses the returned response to display an error message to the Wix user if the action is invalid. Implementing this method is optional. To implement it, select the method under **Service plugin endpoints** when editing your action in the app dashboard. If you don't implement this method, Wix assumes that the action is always valid. As an example, a Wix user configures an action called “Send gift card”, where a gift card is identified by a unique UUID. After some period of time the user deletes the gift card, making the action’s mapping with the current UUID invalid. Validate Configuration checks the validity of the action’s input values, and returns an error to the user if one or more of the values is not valid. --- ## REST API ### Schema ``` Method: validateConfiguration Description: This method is used to validate a Wix user's action configuration. Wix calls this method when a Wix user configures an automation with your action, and when they select the automation from the **Your automations** list in the **Automations** dashboard. Wix uses the returned response to display an error message to the Wix user if the action is invalid. Implementing this method is optional. To implement it, select the method under **Service plugin endpoints** when editing your action in the app dashboard. If you don't implement this method, Wix assumes that the action is always valid. As an example, a Wix user configures an action called “Send gift card”, where a gift card is identified by a unique UUID. After some period of time the user deletes the gift card, making the action’s mapping with the current UUGUID invalid. Validate Configuration checks the validity of the action’s input values, and returns an error to the user if one or more of the values is not valid. 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: actionKey, inputMapping Method parameters: param name: actionKey | type: actionKey | description: Action key as defined in your app's action configuration in the app dashboard. For example, `send-email` or `generate-invoice`. | required: true param name: inputMapping | type: inputMapping | description: Stringified object representing the mapping a Wix user made between keys in the input schema and their expected values when running the automation. A field can be a static value mapping, or an expression that will be evaluated dynamically on each activation. | required: true Return type: ValidateConfigurationResponse - name: valid | type: boolean | description: Whether the action configuration is valid. - name: configurationErrors | type: array | description: Error details for an invalid action configuration. These are the errors displayed to the user. - 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. ``` ### Examples ### Validate Configuration sent by Wix Validate Configuration request with a sample response body ```curl curl -X POST https://provider.example.com/v1/validate-configuration \ -H 'user-agent: Wix' \ -H 'accept-encoding: gzip, deflate' \ -H 'content-type: text/plain; charset=utf-8' \ -d '{ "actionKey": "email-client", "inputMapping": "{ \"accountId\": \"some guid\", \"to\": \"some-email@example.com\", \"subject\": \"Welcome email\", \"body\": \"Hello there!\" }" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.actions.ActionProviderService.validateConfiguration(request, metadata) Description: This method is used to validate a Wix user's action configuration. Wix calls this method when a Wix user configures an automation with your action, and when they select the automation from the **Your automations** list in the **Automations** dashboard. Wix uses the returned response to display an error message to the Wix user if the action is invalid. Implementing this method is optional. To implement it, select the method under **Service plugin endpoints** when editing your action in the app dashboard. If you don't implement this method, Wix assumes that the action is always valid. As an example, a Wix user configures an action called “Send gift card”, where a gift card is identified by a unique UUID. After some period of time the user deletes the gift card, making the action’s mapping with the current UUGUID invalid. Validate Configuration checks the validity of the action’s input values, and returns an error to the user if one or more of the values is not valid. 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: actionKey | type: string | description: Action key as defined in your app's action configuration in the app dashboard. For example, `send-email` or `generate-invoice`. - name: inputMapping | type: string | description: Stringified object representing the mapping a Wix user made between keys in the input schema and their expected values when running the automation. A field can be a static value mapping, or an expression that will be evaluated dynamically on each activation. Return type: PROMISE - name: valid | type: boolean | description: Whether the action configuration is valid. - name: configurationErrors | type: array | description: Error details for an invalid action configuration. These are the errors displayed to the user. - 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. ``` ### Examples ### validateConfiguration ```javascript import { actionProvider } from '@wix/automations/service-plugins'; async function validateConfiguration(request,metadata) { const response = await actionProvider.validateConfiguration(request,metadata); }; ``` ### validateConfiguration (with elevated permissions) ```javascript import { actionProvider } from '@wix/automations/service-plugins'; import { auth } from '@wix/essentials'; async function myValidateConfigurationMethod(request,metadata) { const elevatedValidateConfiguration = auth.elevate(actionProvider.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 { actionProvider } 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: { actionProvider }, // Include the auth strategy and host as relevant }); async function validateConfiguration(request,metadata) { const response = await myWixClient.actionProvider.validateConfiguration(request,metadata); }; ``` ---