# Webhooks for Contact Form 7 — Usage Documentation

## Overview
Webhooks for Contact Form 7 allows you to send Contact Form 7 submissions to a specified webhook URL. This enables integration with various external services and automation tools.

## Installation
1. Download Webhooks for Contact Form 7 from the WordPress Plugin Directory or your repository.
2. Upload the `webhook-for-contact-form-7` folder to your WordPress plugins directory.
3. Activate the plugin via the WordPress admin dashboard.

## Configuration
1. Navigate to **Settings > Webhooks** in your WordPress admin.
2. Enter your webhook URL in the provided field.
3. Optionally, set a Bearer token for authentication.
4. Save your changes.

## Per-form mode (one webhook per form)
If you choose the "One webhook per form" mode in Settings you'll be able to configure a separate webhook URL and an optional Bearer token for each Contact Form 7 form found on your site. This is useful when different forms should post to different endpoints or services.

- Go to **Settings > Webhooks**.
- Select the "One webhook per form" radio option.
- For each form in the list, enter the webhook URL you want that form to post to and an optional Bearer token. Leave a form's URL empty to fall back to the global webhook (if configured).

The plugin sends a JSON payload that includes `form_title`, `page_url`, and all submitted fields. You can also add additional field names (one per line) in the per-form settings; those fields will be included as `additional_<field_name>` in the payload.

### Visual guide
Below are images showing the settings page and the per-form inputs. Add the images to your plugin `assets/images/` folder with the filenames shown below.

![Settings page showing mode selection and global webhook fields](../images/cf7-webhook-settings.png)

![Per-form settings table: webhook URL, Bearer token and additional fields per form](../images/cf7-webhook-per-form.png)

Notes:
- If you set a Bearer token for a specific form, it will be used instead of the global token for that form's webhook request.
- If a per-form URL is empty, the plugin falls back to the global webhook URL (when in global mode that URL must be set).

## Usage
Once configured, the plugin will automatically send form submissions to the specified webhook URL whenever a form is submitted.

### Example Webhook Payload
The data sent to your webhook will include:
- `form_title`: The title of the submitted form.
- `page_url`: The URL of the page where the form was submitted.
- All form fields and their values.

### Additional Fields
You can configure additional fields to be sent with the webhook by specifying them in the plugin settings. These fields will be included in the payload under the key `additional_<field_name>`.

## Troubleshooting
- Ensure your webhook URL is correct and accessible.
- Check for conflicts with other plugins.
- Review WordPress logs for any errors related to the webhook.

## Support
For further assistance, please contact support at [geral@rumostudio.pt](mailto:geral@rumostudio.pt) or open an issue on our GitHub repository.