As a form submission provider, you can integrate with Wix 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 a site visitor's form.
The integration is done via an app in the Wix App Market and by implementing the Form Submissions service plugin. After the app is installed on a site, Wix triggers a call to your service whenever a form is submitted on the site.
It’s important to note the following points before starting to code:
namespace
field in the extension. For example, the namespace for the Wix Forms app is "wix.form_app.form"
.Follow these steps to begin implementing your service plugin.
You can implement this service plugin with the following frameworks:
To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can configure your plugin in the Wix Dev Center. For details, see Form Submissions Extension Configuration.
Use formSubmissions.provideHandlers()
to define the following handler functions that implement your custom business logic. Make sure you define all required functions.
Function | Required |
---|---|
validateSubmission() | Yes |
Below is an example for implementing the Form Submissions service plugin in your code.
This is the basic code structure for implementing the Form Submissions service plugin with the Wix CLI:
import { formSubmissions } from "@wix/forms/service-plugins";
formSubmissions.provideHandlers({
validateSubmission: async (payload) => {
const { request, metadata } = payload;
// Add your logic here
},
});
This is the basic code structure for implementing a self-hosted Form Submissions service plugin:
import { createClient } from '@wix/sdk';
import { formSubmissions } from '@wix/forms/service-plugins'
const wixClient = createClient({
auth: {
appId: <YOUR_APP_ID>,
publicKey: <YOUR_APP_PUBLIC_KEY>
},
modules: { formSubmissions }
});
wixClient.formSubmissions.provideHandlers({
validateSubmission: async (payload) => {
const { request, metadata } = payload;
// Add your logic here
}
});
// Implement a router to process all requests
express.post('/plugins-and-webhooks/*', (req, res) => {
wixClient.process(req);
});