=== Lagoona Webhooks – Send Form Submissions to Any Webhook ===
Contributors: pablocantu, lagoona
Tags: webhook, forms, wp_mail, json, automation
Requires at least: 6.2
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Intercept form submissions from any plugin via wp_mail() and forward them as structured JSON to any webhook URL.

== Description ==

Lagoona Webhooks is a universal webhook forwarder for WordPress. It intercepts emails sent by any form plugin (Contact Form 7, Fluent Forms, JetFormBuilder, WPForms, Gravity Forms, etc.) and forwards the form data as structured JSON to your webhook endpoint.

**How it works:**

1. **Listen Mode** – Turn on "Listen Mode" to discover all sources calling `wp_mail()` on your site.
2. **Submit test forms** – Go to your forms and submit test entries. The plugin detects and registers each source.
3. **Enable webhooks per source** – Choose which sources should forward data to your webhook URL.
4. **Turn off Listen Mode** – Only the selected sources will trigger webhooks, with minimal overhead.

**Features:**

* Universal interception via `wp_mail()` filter – works with any plugin
* Auto-discovery of email sources using backtrace analysis
* Per-source webhook toggle with individual URL configuration
* Structured JSON payload with parsed form fields
* Complete webhook log with payload viewer
* Test webhook functionality
* Automatic log cleanup with configurable retention
* Zero impact when disabled – no hooks attached
* SMTP plugin compatible (WP Mail SMTP, Post SMTP, etc.)

**JSON Payload Example:**

    {
        "plugin": "lagoona-webhooks",
        "site_url": "https://example.com",
        "timestamp": "2026-02-14T10:30:00-06:00",
        "source": {
            "name": "Contact Form 7",
            "slug": "contact-form-7"
        },
        "email": {
            "to": ["admin@example.com"],
            "subject": "New contact form submission",
            "body": "Name: John..."
        },
        "parsed_fields": {
            "name": "John Doe",
            "email": "john@example.com"
        }
    }

== Installation ==

1. Upload the `lagoona-webhooks` folder to `/wp-content/plugins/`.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Lagoona Webhooks** in the admin menu.
4. Configure your default webhook URL in the Settings tab.
5. Turn on Listen Mode and submit test forms to discover sources.
6. Enable webhooks for the sources you want.

== Frequently Asked Questions ==

= Does this work with any form plugin? =

Yes. Lagoona Webhooks intercepts `wp_mail()`, which is used by virtually all WordPress form plugins to send notifications. It has been tested with Contact Form 7, Fluent Forms, JetFormBuilder, WPForms, and more.

= Does it work with SMTP plugins? =

Yes. SMTP plugins like WP Mail SMTP modify how emails are delivered but they do not change how `wp_mail()` is called. Lagoona Webhooks hooks into `wp_mail()` before the SMTP plugin processes the email.

= Does it modify or block emails? =

No. The plugin only reads the email data and forwards it to your webhook. The original email is never modified or blocked.

= What webhook services are supported? =

Any service that accepts HTTP POST requests with JSON body, including Make (Integromat), Zapier, n8n, Pabbly, custom APIs, and more.

= Does it slow down my site? =

When Listen Mode is off and no sources are active, the plugin has zero overhead. When active, it only intercepts `wp_mail()` calls with minimal processing.

== Changelog ==

= 1.0.0 =
* Initial release.
* Listen Mode for source discovery.
* Per-source webhook toggle.
* JSON payload with parsed fields.
* Webhook log with payload viewer.
* Test webhook functionality.
* Automatic log cleanup.
