> ## Documentation Index
> Fetch the complete documentation index at: https://docs.khaime.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Contact Form

> A spam-protected contact form that delivers submissions directly to your Khaime inbox.

# Khaime Contact Form

Add a contact form to any WordPress page. Submissions appear in your Khaime dashboard, are sent to your email, and can trigger push notifications — the same pipeline used by forms on Khaime-hosted sites. They can also be added to campaign audiences.

<Card title="Download the Plugin" icon="download" href="https://api.khaime.com/wordpress/download/khaime-contact-form">
  khaime-contact-form.zip
</Card>

<Note>
  **Spam protection needs zero setup.** Khaime provisions and manages it for your site automatically — no CAPTCHA account to create, no keys to paste, and no domains to configure. A honeypot, a minimum-fill-time check, and per-IP rate limiting run behind the scenes.
</Note>

## Setup

1. Install and activate the plugin.
2. Go to **Khaime → Contact Form** and paste your partner API key (from **Settings → API** in your dashboard). If Khaime Live Chat or Khaime Storefront is already configured on this site, skip this step — the key is shared automatically.
3. Add the shortcode to any page:

```
[khaime_contact_form]
```

<Note>
  The key determines the mode: `pk_live_` keys deliver real submissions, while `pk_sandbox_` keys run in test mode. There is no environment switch to configure.
</Note>

## Shortcode attributes

All attributes are optional.

| Attribute         | Description                                                                        | Default         |
| ----------------- | ---------------------------------------------------------------------------------- | --------------- |
| `form_label`      | Labels submissions in your dashboard so you can distinguish between multiple forms | `contact`       |
| `show_phone`      | Show the phone field (`yes`/`no`)                                                  | `yes`           |
| `require_phone`   | Make the phone field required (`yes`/`no`)                                         | `no`            |
| `require_name`    | Make the name field required (`yes`/`no`)                                          | `yes`           |
| `show_message`    | Show the message field (`yes`/`no`)                                                | `yes`           |
| `require_message` | Make the message field required (`yes`/`no`)                                       | `no`            |
| `submit_label`    | Button text                                                                        | `Send Message`  |
| `success_message` | Displayed after a submission is successfully delivered                             | (from settings) |
| `class`           | Extra CSS class on the wrapper, for per-form styling                               | —               |

The email field is always shown and always required.

**Examples**

```
[khaime_contact_form form_label="support" require_message="yes" show_phone="no"]

[khaime_contact_form form_label="newsletter_signup" show_message="no" require_name="no" submit_label="Notify Me"]
```

## Styling

The form inherits your theme's fonts and colors. Form elements use stable `khcf-` classes — such as `.khcf-form`, `.khcf-field`, `.khcf-submit`, `.khcf-notice--success`, and `.khcf-notice--error` — so you can restyle them from **Appearance → Customize → Additional CSS**:

```css theme={null}
.khcf-submit {
  background: #7c3aed;
  border-radius: 999px;
}
```

The `class` attribute adds your own class to the wrapper, letting two forms on one site look different.

## How your data flows

Submissions travel from the visitor's browser to your WordPress server, then from your server to Khaime. Your partner API key never reaches the browser, the spam-protection secrets never leave Khaime's servers, and no sensitive information is exposed in your pages.

## Local development

Point the plugin to a non-production backend by adding the following to `wp-config.php`:

```php theme={null}
define('KHAIME_API_URL', 'http://localhost:4000/api/v1');
```

<Warning>
  The spam-protection check requires **HTTPS**: it works on `https://` pages and on `localhost`, but fails to load on plain-HTTP custom hostnames. If you use Local by Flywheel, enable SSL for the site (**Trust** on the site's Overview) and browse the `https://` URL.
</Warning>

## Troubleshooting

**"Please complete the 'Verify you are human' check."**

The check was either not completed or expired after sitting completed for a few minutes. Complete the check again and resubmit the form.

**The verification box isn't appearing, but the settings screen says connected.**

The plugin caches its configuration for up to 12 hours. Select **Test connection** on the settings screen to refresh the configuration immediately. If your site uses page caching, purge the cache as well.

**Submissions are rejected with a spam-protection error even after completing the check.**

Select **Test connection**, reload the page to get a fresh check, and try again. Completed checks are single-use, so a retried submission always needs a new one.

### Still stuck?

If you've followed the steps above and still need help, reach out — include your site URL and whether **Test connection** succeeds:

<CardGroup cols={2}>
  <Card title="Email support" icon="envelope" href="mailto:support@khaime.ai">
    [support@khaime.ai](mailto:support@khaime.ai)
  </Card>

  <Card title="Community" icon="discord" href="https://discord.gg/khaime">
    Ask in the Khaime Discord
  </Card>
</CardGroup>
