How to Send WhatsApp Messages from Wix Forms Using Zaple.ai
A clean, secure, and production-ready guide using Wix Velo.
Are you looking for a reliable way to instantly engage with your website visitors the moment they reach out?
If you're using Wix Forms V2 and want to automatically send a WhatsApp template message after a successful form submission, you're in the right place. In this guide, we'll walk you through a clean, secure, and production-friendly setup using Zaple.ai and Wix Velo.
By connecting your Wix form to Zaple.ai's powerful API, you can instantly follow up with leads, confirm event registrations, or send rich media like images and documents directly to their WhatsApp.
Let's build the integration with Wix's official backend form event so the workflow remains practical without exposing customer data or Zaple credentials in the browser.
Why Connect Wix Forms to WhatsApp?
In today's fast-paced digital world, email follow-ups often get lost in spam folders. WhatsApp, boasting a 98% open rate, helps businesses engage leads quickly in a channel customers check throughout the day.
With this integration, you achieve:
- Instant Lead Engagement: Strike while the iron is hot by messaging users right after they submit an inquiry.
- Secure Architecture: Keep your API keys hidden on the backend using Wix Secrets Manager.
- Rich Media Support: Zaple's v3 API allows you to send stunning templates with image headers and dynamic variables seamlessly.
What We Are Building: The Integration Flow
- A visitor submits your Wix Forms V2 form.
- Wix stores the submission and fires its official
wixForms_onSubmissionCreated()backend event. - The event handler maps the required fields and verifies the WhatsApp consent field.
- A private Wix Data collection prevents duplicate sends for the same submission.
- The backend retrieves your Zaple credentials from Wix Secrets Manager.
- A POST request triggers Zaple’s v3 template-message API.
- Record the accepted API response, then monitor the message's asynchronous delivery state.
Prerequisites
Before we write any code, ensure you have the following ready:
- A published Wix site with Velo (Dev Mode) enabled.
- A Wix Forms V2 form embedded on a page.
- An active Zaple.ai account.
- An approved WhatsApp template in your Zaple dashboard.
- Your Zaple Template ID.
- A public image URL (if your template features a media header).
Step 1: Securely Store Your Zaple API Secrets in Wix
Never hardcode API keys in your frontend code. Using Wix Secrets Manager ensures your credentials stay secure.
Go to your Wix Dashboard → Settings → Secrets Manager and create these two secrets:
Zaple_API_KeyZaple_API_Secret
Step 2: Configure Your Wix Page Code (Frontend)
Open your Wix Editor, turn on Dev Mode, and select your form page. Frontend code should only manage the confirmation UI; it must not call a credential-backed message sender or log submitted fields.
Add the following code to your page:
Pro Tip: We use onSubmitSuccess() because it only runs after the server has completely and successfully received the submission.
Step 3: Connect the Wix Backend Form Event
In your Wix site's Backend section, create or open events.js. Wix Forms V2 fires wixForms_onSubmissionCreated() after a submission is created. Replace the form ID and field keys with the values from your form:
Next, create backend/zaple.js. Also create a private CMS collection named ZapleProcessedSubmissions; the submission ID becomes its unique record ID so a retried event cannot send twice:
⚠️ Do Not Expose the Send Helper
A public or member-callable Web Method backed by messaging credentials can be invoked outside the visible form and abused. The backend event above preserves the automation while keeping the credential-backed sender inaccessible to site visitors. Wix backend events run on a published site, not in normal Preview mode.
Step 4: Map Your Wix Form Field IDs Exactly
Your backend handler must map the exact field keys in the trusted Wix form-event payload for the Forms version you use.
If your output looks like this:
Map first_name and whatsapp_number_1 in the backend event handler, verify explicit WhatsApp consent, and pass a stable submission ID through the idempotency guard.
Step 5: Handling Media in WhatsApp Templates
If your approved WhatsApp template in Zaple has an image or document header, you must include the media fields in your payload:
Note: Ensure the URL used is publicly accessible and does not require authentication to view.
Step 6: Testing and Troubleshooting
Publish the site, submit one consented test form, and monitor privacy-safe status logs in the Wix dashboard. Wix backend events do not run in normal Preview mode. Verify that the trusted backend event—not the browser—invokes the helper exactly once.
What You Should See:
- Frontend UI: a normal form success state with no provider response or submitted fields exposed.
- Backend Logs: HTTP status, a privacy-safe correlation ID, and structured error category only—never the raw provider response.
- Test contact: verify the consented message, then reconcile its provider status to the saved request record.
Quick Troubleshooting Guide:
- The backend helper never runs?
Confirm the event or automation is attached to the correct Wix Forms version, adapt the event payload mapping, and verify that the helper stays backend-only. - Backend is running, but no WhatsApp message is received?
Check for invalid API Keys / Secrets, using the wrongtemplate_id, or an invalid phone number format. If you are passingcountry_code: "91", make suresend_toonly contains the 10-digit local number (e.g.,9876543210, not919876543210). - Dynamic Template Variables are blank?
If your template says "Hi {{1}}, thank you...", you must passbody_text1: firstNamein your Zaple payload. Check Zaple's template setup for exact variable indexing.
Final Thoughts
Integrating Wix Forms V2 with Zaple.ai is one of the most practical and impactful automations you can build for lead generation, event registration, and customer inquiries.
By combining Wix's backend submission event with Zaple's API, you keep credentials private while delivering a rapid, personalized WhatsApp experience. For the supported workflow and setup options, see Zaple's Wix WhatsApp integration.
Ready to Turbocharge Your WhatsApp Messaging?
Start building seamless customer journeys with WhatsApp Business API.
Frequently Asked Questions
Can I run this code without Wix Dev Mode (Velo)?
No. You need to enable Dev Mode in Wix to add custom Javascript and create the required backend Web Modules.
Why shouldn't I just make the API call from the page code?
Making the API call from the frontend exposes your private Zaple_API_Key and Zaple_API_Secret to the public. Anyone viewing your site's source code could steal your credentials and send messages on your behalf.
Do I need a paid Zaple account to do this?
You will need an active Zaple account configured with the WhatsApp Business API. Check Zaple.ai pricing for tier limits on template messages.
What if the user submits a messy phone number format?
Normalize and validate the phone number in the trusted backend handler after checking consent. Browser-side formatting may improve UX, but it is not a security boundary.