Create a WordPress user from a Contact Form 7 submission
Every Contact Form 7 submission becomes a WordPress user.
The webhook posts to the site's own REST API (/wp/v2/users) using a vault credential, so no password ever travels in the build. Field mapping carries your-email and your-name across; a pre-dispatch Code Glue snippet fills in the two fields the REST endpoint requires but the form does not collect — a username derived from the email address, and a generated password.
Before importing: point the endpoint at your own site, create a credential for a user who can create accounts, and check that the form field names match your form.
/ The conversation
This build was not assembled by hand. Its author described what they wanted in Build with AI, and the agent read the site, planned the work and applied it. This is that conversation.
lets create new user from cf7 submission, use WP rest APi to create that user
Checking the captured payload for Contact Form 7 submissions, the WP REST API schema for user creation, and existing credentials...
I've analyzed the Contact Form 7 captured payload and the REST API requirements for creating users (/wp/v2/users).
Plan Overview:
- Create Webhook: Target
https://example.com/wp-json/wp/v2/usersonwpcf7_mail_sent(asynchronous mode). - Assign Auth Credential: Use existing internal WP REST API credential (ID: 29).
- Map Payload Fields: Map
your-emailtoemailandyour-nametoname. - Code Glue Snippet: Automatically generate the required
username(from email prefix) and a secure randompasswordprior to dispatch. - Preview & Assign Snippet: Attach the snippet to pre-dispatch.
- Test Dispatch: Run a test submission to verify end-to-end integration.
Published by the author on purpose. Tool output and raw payloads never travel with a shared build, and secrets never leave the site they were created on.
/ Abilities used (7)
- create_webhook Create webhook pointing to local WP REST API user endpoint
- assign_credential Attach internal REST API credential (ID 29) to the webhook
- set_mapping Map CF7 email and name fields to WP User arguments
- create_snippet Create pre-dispatch PHP snippet to generate required username and password
- preview_snippet Preview pre-dispatch snippet transformation against captured payload
- assign_snippet Assign pre-dispatch snippet to webhook trigger
- test_dispatch Execute test dispatch to verify user creation in WordPress
Each of these is a real ability the agent can call — see the docs for what each one does.
/ What runs
Every attempt is retried on its own schedule and written to the delivery log.
WordPress fires the action wpcf7_mail_sent, the payload is mapped and sent as POST to example.com.
The delivery is queued and sent in the background, so the visitor never waits. Along the way a Code Glue snippet shapes the payload first and authentication comes from a credential you supply on import.
/ How it is configured
/ Field mapping
/ Code Glue
before sending — Generate Username & Password for WP User Creation
if (!empty($payload['email'])) { if (empty($payload['username'])) { $payload['username'] = strstr($payload['email'], '@', true) ?: $payload['email']; } if (!empty($payload['username'])) { $payload['username'] = str_replace(' ', '-', $payload['username']); $payload['username'] = preg_replace('/[^A-Za-z0-9\-]/', '', $payload['username']); } if (!empty($payload['name'])) { $payload['name'] = str_replace(' ', '-', $payload['name']); $payload['name'] = preg_replace('/[^A-Za-z0-9\-]/', '', $payload['name']); } if (empty($payload['password'])) { $payload['password'] = wp_generate_password(16, true); } } return $payload;
Read any snippet before you import it — Code Glue runs PHP on your site.
/ Authentication
This build authenticates with a credential you supply on import. The shared file carries the name and type only — never the secret.
- WP REST API (internal) — admin — basic
/ Use this build
Download the file, then in WordPress open Webhook Actions → Webhooks → Import and drop it in. Anything needing authentication asks you to pick or create a credential as it imports — see Import & Export for what travels with a build and what does not.
/ Questions