Divi Contact Form
Contact module in Divi Builder / Elegant Themes.
Keys required. Create a site in the dashboard and copy your site key (HTML) and secret key (server). Replace
sq_live_your_key in the snippets below.
How this integration works
Same three steps as every other platform — only the paste location and server hook change.
| Step | What you do for Divi Contact Form |
|---|---|
| 1 | Load squeaker.js once site-wide (footer or plugin). |
| 2 | Divi module → add Code module with widget inside the row near the form. |
| 3 | Hook et_pb_contact_form_submit to verify squeaker-token before the entry is saved. |
Where to put the widget
Divi module → add Code module with widget inside the row near the form.
Server-side hook (WordPress)
Verify the token in et_pb_contact_form_submit before the form plugin saves the submission.
Verify in child theme functions.php before Divi processes the module.
Recommended settings
| Setting | Value |
|---|---|
| Widget mode | Auto (recommended) — Runs on form submit — best for most forms |
| Form selector | form.et_pb_contact_form (used in data-form for auto mode) |
| Server verify | PHP |
Copy-paste snippet
Paste into your Divi Contact Form form or template. Load squeaker.js once per page.
<!-- Divi module → add Code module with widget inside the row near the form. -->
<squeaker-widget
data-sitekey="sq_live_your_key"
data-api="https://api.squeaker.cc/v1"
data-mode="auto"
data-theme="light"
data-form="form.et_pb_contact_form"
></squeaker-widget>
<!-- Load once site-wide (footer or plugin) -->
<script src="https://cdn.squeaker.cc/squeaker.js" async defer></script>
<!-- functions.php — Verify in child theme functions.php before Divi processes the module. -->
add_action('et_pb_contact_form_submit', function () {
$token = $_POST['squeaker-token'] ?? '';
// POST to https://api.squeaker.cc/v1/verify with SQUEAKER_SECRET — wp_die() or return error if invalid
}); Server verification
Read squeaker-token from the request and POST to /v1/verify with your secret key.
Full reference: Server verify docs.
$token = $_POST['squeaker-token'] ?? '';
if ($token === '') {
http_response_code(400);
exit('Missing token');
}
$apiUrl = getenv('SQUEAKER_API_URL') ?: 'https://api.squeaker.cc/v1';
$payload = json_encode([
'secret' => getenv('SQUEAKER_SECRET'),
'token' => $token,
'remoteip' => $_SERVER['REMOTE_ADDR'] ?? null,
]);
$ctx = stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\n",
'content' => $payload,
],
]);
$response = file_get_contents("{$apiUrl}/verify", false, $ctx);
$result = json_decode($response, true);
if (!$result['success']) {
http_response_code(403);
exit($result['error'] ?? 'Invalid token');
}
// Token valid — process the form Open setup generator with Divi Contact Form pre-selected · Browse all platforms