About the Form Submission Service Plugin

As a provider of form submission service plugin (formerly SPI), you can integrate your service with Wix's forms to allow site owners to request and use your services on their Wix sites. By integrating your service with Wix, the service validates and submits site visitor's form.

The integration is done via an app in the Wix App Market (created in the app dashboard) and the Form Submission service plugin.

Learn more about implementing a service plugin with Wix.

Before you begin

  • The Form Submission service plugin only works with the Wix Forms app. Call GetAppInstance to confirm that the app named wix_forms is installed on the site.
  • There are several apps that use forms. To validate form submission for a specific Wix app, configure your app in the app dashboard for that Wix app by defining the relevant namespace field in the extension. For example, the namespace for the Wix Forms app is "wix.form_app.form".

Use cases

Using the service plugin, you can design your app to validate a form after a site visitor submits it, including:

  • Field validations: Check if the email address is in the correct format or that the name contains only alphabetic characters.
  • Prevent submission of invalid data: Disable the submit button until all fields are correctly filled out.
  • Real-time feedback: Highlight the invalid fields.
  • Prevent duplicate submissions: Check for duplicate submissions based on certain criteria and prevent site visitors from submitting the same form multiple times.

Configuration

To enable Wix to communicate with your app:

  1. Go to Extensions in your app's dashboard.
  2. Click Create Extension in the top right corner.
  3. Filter by Wix Forms in the left menu. Then find Form Submission and click Create.
  4. Provide the following configuration:
NameTypeDescription
deploymentUristringRequired. URI which Wix Forms calls to retrieve the validation. The URI consists of base URI and endpoint path.
For example, "deploymentUri": "https://my-validations.com/v4/validateSubmission" where https://my-validations.com/ is a base and v4/validateSubmission is the endpoint path.
namespaceConfigsArray of objectsA collection of Wix apps.
namespaceConfigs.namespacestringThe app which the form submissions belong to:
  • Wix Forms: wix.form_app.form
  • Wix Pricing Plans: wix.pricing_plans.v1.custom_form
  • Wix Online Programs: wix.achievements.quizzes.v1.quiz
formIdstringForm ID which submissions will be validated. This field is optional. If you won't provide the form ID, submissions from all forms in the defined app will be validated.
namespaceConfigs.submissionValidationEnabledbooleanWhether to enable the submission validation in your app.

Terminology

TermDefinition
SubmissionData received when a site visitor submits a form.
ValidationProcess that makes sure the information that the site visitor put into a form is correct and meets certain rules.
FormOnline interface that allows site visitors to input and submit data.
Did this help?

Form Submission Service Plugin: Sample Use Cases & Flows

This article presents sample flows your app can support. You aren't limited to this exact flow, but it can be a helpful jumping off point as you plan your Submissions service plugin integration.

Validate an email field

  1. A site visitor enters an email address into a form field and submits the form.

  2. Wix sends a Validate Submission service plugin request to your app.

  3. Your server validates the request. The email isn't valid, and the server sends an object containing the error.

    Example of a violation response from your app:

    Copy
    { "validationResult": { "errors": [ { "errorPath": "submission.submissions.email", "errorMessage": "Wrong email format", "params": {}, "useCustomErrorMessage": true } ] } }
  4. The email field is highlighted on the form, notifying the site visitor that the email is invalid.

  5. After this validation, the site visitor corrects the email and submits the form.

  6. Again Wix sends a Validate Submission service plugin request to your app.

  7. Your server validates the request. The email is valid and the server sends an object containing an empty list.

Prevent duplicate submissions

  1. A site visitor submits the same form again, which is permitted.

  2. Wix sends a Validate Submission service plugin request to your app.

  3. Your server checks for a unique submission token and validates the request. The server finds the duplicate and returns an object containing error.

    Example of a violations response from your app:

    Copy
    { "validationResult": { "errors": [ { "errorPath": "submission.count.forbidden", "errorMessage": "Form submitted more than 1 time", "params": {}, "useCustomErrorMessage": true } ] } }
  4. With this validation violation, the site visitor can't submit this form again.

Did this help?

Form Submission Service Plugin: Errors

This article outlines error messages that might be issued when calling the Form Submission service plugin.

Validate Submission Errors

The Validate Submission service plugin might issue the following error messages:

Error codeError message
TYPE_ERRORThe type of the submitted value is invalid. For example, a number is submitted instead of string.
REQUIRED_VALUE_ERRORThe required field value is not provided.
UNKNOWN_VALUE_ERRORThe submitted value is unknown.
MAX_LENGTH_ERRORThe submitted value exceeds the maximum length.
MIN_LENGTH_ERRORThe submitted value doesn't reach the minimum length.
PATTERN_ERRORThe submitted text value is not applicable for the predefined pattern. For example, a phone number pattern is (000) 000-0000 and the site visitor entered (123)4567890.
FORMAT_ERRORThe submitted text value is not applicable for the standard format. For example, the email is entered without the @ symbol.
MAX_VALUE_ERRORThe submitted numeric value is too large.
MIN_VALUE_ERRORThe submitted numeric value is too small.
MULTIPLE_OF_VALUE_ERRORThe submitted numeric value does not evenly divide by the specified value. For example, the number doesn't divide by 3 without leaving a remainder.
MIN_ITEMS_ERRORThe submitted value array doesn't reach the required minimum number of items.
MAX_ITEMS_ERRORThe submitted value array exceeds the number of maximum items.
NOT_ALLOWED_VALUE_ERRORThe submitted value is not in the list of allowed values.
DISABLED_FORM_ERRORThe form is disabled.
Did this help?

Submission Extension Object


SPI that allows providing additional actions on existing submission namespaces.

Properties
deploymentUriDeploymentUri

Deployment URI where the endpoints are called. Wix Forms appends the endpoint path to the deployment URI. For example, to call the Validate Submission endpoint at https://my-form-submissions.com/v1/validateSubmission, the deploymentUri you provide here is https://my-form-submissions.com/.


namespaceConfigsArray <FormsSubmissionsExtensionNamespaceConfig>maxItems 10

Namespace names.

Did this help?

POST

Validate Submission


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Note: The Form Submission service plugin only works with the Wix Forms app. Call GetAppInstance to confirm that the app named wix_forms is installed on the site.


Validates a submission.
Validates a site visitor's form submission and returns any validation violations.
Site visitors can see the validation violations on their forms. For example, invalid fields are highlighted in red.

Permissions
Manage Submissions
Learn more about app permissions.
Endpoint
POST
{DEPLOYMENT-URI}/v4/submissions/validate
Body Params
submissionSubmissionRequired

Submission to validate.


actionTypestringRequired

Whether to create or update the submission.


updateOptionsUpdateOptions

Data for updating an existing submission.

Response Object
errorsArray <SubmissionValidationError>maxItems 100

List of validation errors.
If there are no validation errors, returns an empty array.

Validate submission
Request
cURL
curl -X POST \ 'http://www.wixapis.com/form-submission/v4/submissions/validate' \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>' \ -d '{ "submission": { "id": "e62e3011-55cf-4de3-a497-e097b52d86b7", "formId": "e62e3011-55cf-4de3-a497-e097b52d86b8", "namespace": "wix.form_app.form", "status": "PENDING", "submissions": { "first_name": "J0hn", "last_name": "Doe" "fiend_list": ["Tom", "Sally", "Bob"] }, "submitter": { "memberId": "4b42fb49-8c77-4128-859c-8247756f68ef" }, "seen": false, "revision": 1, "createdDate": "2019-10-30T17:22:10.299Z", "updatedDate": "2019-10-30T17:22:10.299Z" }, "actionType": "CREATE", "createOptions": {} }'
Response
JSON
{ "validationResult": { "errors": [ { "errorPath": "first_name", "params": {}, "errorType": "TYPE_ERROR" }, { "errorPath": "fiend_list/2", "params": {}, "custom_error_message": "Bob is not a friend" } ] } }
Did this help?