# Webhooks for Contact Form 7

## Overview
Webhooks for Contact Form 7 extends the functionality of the Contact Form 7 plugin for WordPress by allowing users to send form submissions to any webhook endpoint. This enables seamless integration with external services, automation tools, and custom workflows.

## Features
- Send Contact Form 7 submissions to any webhook URL.
- Support for custom headers and payloads, including optional Bearer token authentication.
- Easy setup and configuration through the WordPress admin interface.
- Compatible with popular automation platforms.
- *NEW*: Logs webhooks requests

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

## Configuration
- Navigate to **Settings > Webhooks** in your WordPress dashboard.
- Enter your webhook URL and optional Bearer token.
- Save changes to apply the configuration.

## Usage
For detailed usage instructions, please refer to the [Usage Documentation](assets/docs/usage.md).

## Troubleshooting
If you encounter issues, ensure that:
- The webhook URL is correct and accessible.
- There are no conflicts with other plugins.
- Review WordPress logs for any errors.

## Contributing
Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.

## License
This plugin is licensed under the GPL v2 or later. See the [License](https://www.gnu.org/licenses/gpl-2.0.html) for more details.

## Contact
For support or feature requests, please contact us at [geral@rumostudio.pt](mailto:geral@rumostudio.pt).

## Logging

This plugin records webhook delivery attempts and response previews in the WordPress admin to help you troubleshoot integrations.

- Where: View logs in the plugin settings page under Settings → WBHKS Webhook.
- What is logged: date/time, form title & ID, delivery status (success / failed / skipped), HTTP status code (when available), webhook URL used, a short message and a truncated response body (preview up to ~1000 characters).
- Privacy: The plugin does not log submitted form field values or other user PII. Only delivery metadata and response previews are stored by default.
- Storage: Logs are stored in the WordPress options table under the option name `wbhks_webhook_logs` and are limited to the most recent 200 entries by default (`WBHKS_Webhook::LOG_LIMIT`).
- Clearing: Use the “Clear Logs” button on the settings page to delete all logs. Clearing is protected by a capability check and a WordPress nonce.

Developer note: the option name and limit are defined on the `WBHKS_Webhook` class as `LOG_OPTION` (`wbhks_webhook_logs`) and `LOG_LIMIT` (200).
