How to Connect WordPress Forms to Mautic Using n8n (Step-by-Step)
Automate lead capture from WordPress forms into Mautic using an n8n workflow: webhook intake, data normalization, email validation and contact creation.
Why automate WordPress forms to Mautic?
Automating form submissions from WordPress into Mautic saves time, reduces manual errors and ensures faster follow-up. By pairing WordPress webhooks with n8n you can:
- Capture leads in real time
- Normalize and validate data before creating contacts
- Prevent invalid emails from polluting your CRM
- Send alerts for manual review or blacklist invalid addresses
Overview of the n8n workflow
The provided workflow implements a simple, reliable pipeline:
- WordPressWebhook — receives POST form data from WordPress
- NormalizeLead (Set node) — extracts and formats fields (name, email, mobile, form id)
- MauticCreateContact — creates a contact in Mautic using normalized fields
- EmailValidation (If node) — checks whether the email passed basic validation
- NotifyInvalidEmail (Slack or other) + MauticDoNotContact — mark invalid contacts and notify team
- End — workflow end node
This flow protects your Mautic instance from invalid data while keeping the team informed when action is required.
Step-by-step setup
1. Create a WordPress webhook
Use your form plugin (Contact Form 7, Gravity Forms, WPForms, etc.) to send submissions via webhook to n8n. In n8n create a Webhook node and copy the webhook URL into your form’s webhook/conversation settings. Set HTTP method to POST and ensure content-type is application/x-www-form-urlencoded or application/json depending on your plugin.
2. Normalize incoming data
Use the Set node in n8n to map incoming fields to friendly variable names and perform lightweight formatting:
- name: format with toTitleCase()
- email: toLowerCase() and basic syntax check
- mobile: strip country formatting as needed
- form: preserve form_id for segmentation
Example mapping expressions (n8n):
name = {{$json.body.Nome.toTitleCase()}}
email = {{$json.body['E-mail'].toLowerCase()}}
3. Create contact in Mautic
Configure the Mautic node with your API credentials and map the normalized fields. At a minimum map email and firstName; add mobile to additionalFields for SMS/WhatsApp follow-up.
4. Validate email and handle invalid cases
Use an If node to check the boolean result of your email validation expression (for example, $json.email_valid). If the email is valid, allow the normal path. If invalid, do two things:
- Send a notification (Slack, email or internal tool) so a human can review
- Edit the contact in Mautic to add them to a Do Not Contact list or tag them for manual cleanup
5. Finalize and test
Submit sample forms from your WordPress site and monitor the n8n execution logs. Verify:
- Normalized fields are correct
- Contacts are created in Mautic with proper field mapping
- Invalid emails are flagged and notified
Best practices and tips
Secure your webhook
Restrict access to the webhook by:
- Using a secret token parameter and validating it in n8n
- Limiting requests by IP (if possible)
- Running n8n behind HTTPS and authentication
Improve email verification
Basic pattern checks are a good start, but for higher quality leads consider:
- Sending an API call to an email verification provider (ZeroBounce, Kickbox, etc.)
- Using domain MX lookup to spot invalid domains
- Applying heuristics for disposable email providers
Map more fields for richer profiles
Add UTM, landing page, or form_id fields to Mautic to improve segmentation and attribution. Keep field names consistent between WordPress, n8n and Mautic to reduce mapping errors.
Rate limits and retry strategy
Watch for API rate limits on Mautic. Add retry logic or queueing (n8n’s Execute Workflow or external queues) to prevent data loss when Mautic is temporarily unavailable.
Troubleshooting
Common issues
- No data arriving in n8n: verify webhook URL and that the form is configured to POST
- Malformed JSON: switch Content-Type between application/json and urlencoded depending on the plugin
- Mautic authentication errors: re-check OAuth/API credentials and token expiry
Logging and monitoring
Enable verbose logging in n8n and use Slack or email notifications for failed executions. Maintain a small dashboard for webhook success/failure rates to spot trends quickly.
Extending the workflow
You can extend this template to:
- Enrich contacts with third-party data (Clearbit, FullContact)
- Trigger onboarding email sequences from Mautic based on form type
- Perform real-time lead scoring and route high-value leads to sales
