---
title: "Create a WordPress user from a Contact Form 7 submission — Automation"
description: "A Contact Form 7 submission is mapped onto the WordPress REST API and creates a user account. Code Glue derives the username from the email address and…"
url: "https://wpwebhooks.org/automations/create-a-wordpress-user-from-a-contact-form-7-submission/"
date: "2026-07-31"
---

[WP Webhooks](https://wpwebhooks.org/) / [Automations](https://wpwebhooks.org/automations/) / Create a WordPress user from a Contact Form 7 submission

Webhook Pro [Built with AI — read the conversation ↓](#the-conversation) #contact-form-7

# 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](https://wpwebhooks.org/docs/build-with-ai/), and the agent read the site, planned the work and applied it. This is that conversation.

model gemini-flash-latest via hosted AI credits

Author

lets create new user from cf7 submission, use WP rest APi to create that user

Build with AI

Checking the captured payload for Contact Form 7 submissions, the WP REST API schema for user creation, and existing credentials...

Build with AI

I've analyzed the Contact Form 7 captured payload and the REST API requirements for creating users (`/wp/v2/users`).

Plan Overview:

1.  **Create Webhook**: Target `https://example.com/wp-json/wp/v2/users` on `wpcf7_mail_sent` (asynchronous mode).
2.  **Assign Auth Credential**: Use existing internal WP REST API credential (ID: 29).
3.  **Map Payload Fields**: Map `your-email` to `email` and `your-name` to `name`.
4.  **Code Glue Snippet**: Automatically generate the required `username` (from email prefix) and a secure random `password` prior to dispatch.
5.  **Preview & Assign Snippet**: Attach the snippet to pre-dispatch.
6.  **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)

1.  create\_webhook Create webhook pointing to local WP REST API user endpoint
2.  assign\_credential Attach internal REST API credential (ID 29) to the webhook
3.  set\_mapping Map CF7 email and name fields to WP User arguments
4.  create\_snippet Create pre-dispatch PHP snippet to generate required username and password
5.  preview\_snippet Preview pre-dispatch snippet transformation against captured payload
6.  assign\_snippet Assign pre-dispatch snippet to webhook trigger
7.  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](https://wpwebhooks.org/docs/) for what each one does.

/ What runs

Create WP User from CF7 Submission

WordPress fires

wpcf7\_mail\_sent

→ Field mapping

2 fields mapped

→ Code Glue

Generate Username & Password for WP User Creation before sending

→ Queued, then sent

POST https://example.com/wp-json/wp/v2/users with your credential

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

Create WP User from CF7 Submission

wpcf7\_mail\_sent

/ Field mapping

WordPress payload Sent as

args.0.submission.fields.your-email ──▶↓ email

args.0.submission.fields.your-name ──▶↓ name

/ 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](https://wpwebhooks.org/docs/import-export/) for what travels with a build and what does not.

A like sends 20 AI credits to whoever published this.

/ Published by

Flow Systems

[Website ↗](https://wpwebhooks.org)

/ Questions

Do I need the Pro plugin for this build? +

Yes. This build attaches Code Glue snippets, which are a Pro feature. Everything else in it — the webhook, its triggers, the field mapping and the conditions — works on the free plugin.

How do I use it on my own site? +

Download the JSON, then in WordPress open Webhook Actions → Webhooks → Import and drop the file in. Anything that needs authentication asks you to pick or create a credential during the import — secrets are never part of a shared build.

Does the build contain the author's API keys? +

No. Export carries credential metadata only — the name, the type and a masked hint — never the secret itself. The Credentials Vault is write-only over the API by design.

/Publish

## Publish your automation and get 50 AI credits,  
+20 for each like.

[Install Plugin→](https://wordpress.org/plugins/flowsystems-webhook-actions/) [Get Pro →](https://wpwebhooks.org/pricing/)

$ wp plugin install flowsystems-webhook-actions --activate

## Structured data

```json
{"@context":"https://schema.org","@type":"TechArticle","headline":"Create a WordPress user from a Contact Form 7 submission","description":"A Contact Form 7 submission is mapped onto the WordPress REST API and creates a user account. Code Glue derives the username from the email address and…","url":"https://wpwebhooks.org/automations/create-a-wordpress-user-from-a-contact-form-7-submission/","datePublished":"2026-07-31T14:30:53+00:00","author":{"@type":"Person","name":"Flow Systems"},"isPartOf":{"@type":"WebSite","name":"WP Webhooks","url":"https://wpwebhooks.org"},"about":{"@type":"SoftwareApplication","name":"Webhook Actions","applicationCategory":"WordPress Plugin"},"mainEntity":{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Do I need the Pro plugin for this build?","acceptedAnswer":{"@type":"Answer","text":"Yes. This build attaches Code Glue snippets, which are a Pro feature. Everything else in it — the webhook, its triggers, the field mapping and the conditions — works on the free plugin."}},{"@type":"Question","name":"How do I use it on my own site?","acceptedAnswer":{"@type":"Answer","text":"Download the JSON, then in WordPress open Webhook Actions → Webhooks → Import and drop the file in. Anything that needs authentication asks you to pick or create a credential during the import — secrets are never part of a shared build."}},{"@type":"Question","name":"Does the build contain the author's API keys?","acceptedAnswer":{"@type":"Answer","text":"No. Export carries credential metadata only — the name, the type and a masked hint — never the secret itself. The Credentials Vault is write-only over the API by design."}}]}}
```
