Connect WordPress Forms to the WhatsApp API
Connect a WordPress form with WhatsApp follow-up
A form submission can start a customer follow-up workflow in Piyion. The integration should validate the submission, check the customer’s WhatsApp permission and send the appropriate message from the server.
What you need
- Administrator access to the WordPress site.
- A configured Piyion account and the integration details supplied for that account.
- A form with the relevant name, phone and permission fields.
- An appropriate WhatsApp template and a team responsible for replies.
1. Create the form
Install Contact Form 7 from the official WordPress plugin directory if it is not already available. Create or edit the form, configure its email settings and add it to the intended page using the supported block or shortcode. The official Contact Form 7 guide explains these steps.
2. Configure the integration on the server
Keep the Piyion API credential in protected server-side configuration. Do not paste it into a page, a public HTML block or browser JavaScript: visitors can inspect those values.
If your team has the Piyion WordPress connector, use its connection settings for the company, sending number and account credential. In the form configuration, map the name, phone and WhatsApp permission fields. Ask the Piyion team for the current connector and integration instructions for your account.
For a custom integration, a developer should use validated server-side processing and the WordPress HTTP API. Confirm the current endpoint and payload with Piyion instead of copying an old example into a public page.
3. Send only after the intended successful submission
A browser event alone should not authorize a WhatsApp send. The integration must verify the form result, validate the phone number and check the permission field. Spam, failed validation and unsuccessful submissions should not trigger the welcome workflow.
4. Test the complete flow
Use a controlled test contact with permission. Check a valid submission, an invalid phone number, an unchecked WhatsApp permission field and an unsuccessful form submission. Confirm that the intended message is sent only in the valid case and that retries do not create duplicate messages.
Review the confirmation page, error handling and the team’s ability to continue the conversation. Keep API credentials out of public error messages and logs.
Agree on the data contract
Document which form field supplies each value in the follow-up. Keep the field name, an example value and the rule for missing or invalid input together. Names, phone numbers and template variables should not depend on the order in which inputs happen to appear in a browser event.
Store a phone number as text so that its prefix is preserved. Ask for the country explicitly or use a validated international format; do not remove digits merely because a number looks longer than a local example. When the destination is ambiguous, return a useful correction request instead of guessing who should receive the message.
Separate form success from message delivery
There are several distinct outcomes: the website accepted the form, the integration submitted a request, the messaging service accepted it and the recipient received the message. A successful HTTP response does not prove delivery to the customer. Make the confirmation page describe only what your application actually knows.
For example, the page can acknowledge that the enquiry was received while the team checks the messaging result separately. If WhatsApp delivery fails, preserve the valid customer enquiry for the team to review. Do not tell a visitor that their form failed solely because a later communication step could not be completed.
Prevent duplicate follow-ups
Visitors may click twice, retry after a slow response or refresh a confirmation page. Define a stable identifier for each accepted submission and record whether its intended follow-up has already been processed. A retry should continue the same task rather than create a new message every time.
Decide which failures are suitable for a later retry and which need correction first. An invalid destination or missing template value will not improve by repeating the same request. Keep retry limits and a route for manual review so that a temporary failure does not create an uncontrolled loop.
Make failures understandable to the team
Record the submission reference, time, outcome and relevant service error code. Avoid logging full credentials or unnecessary personal information. Give the responsible person enough context to distinguish a form-validation problem from an integration failure or a delivery issue.
Keep the integration instructions alongside the form configuration and review them when fields, templates or account settings change. After an update, repeat the valid, invalid and duplicate-submission tests. This makes the workflow maintainable and helps the team notice a broken follow-up before many customers are affected.
Contact Piyion to review the integration. For the follow-up process, explore the Piyion WhatsApp CRM.



