=== Webhook Watchdog for WooCommerce ===
Contributors: catcodestudio
Tags: woocommerce, webhooks, monitoring, integrations, api
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce switches a webhook off after five failed deliveries and warns nobody. This plugin notices, tells you, and can switch the working ones back on.

== Description ==

WooCommerce keeps a failure counter on every webhook. After five consecutive failed deliveries it sets the webhook to **disabled** — silently. No notice, no e-mail, no entry anywhere the shop owner is likely to look.

The result is always the same story: the integration on the other end — Printful, a CRM, a warehouse, an accounting bridge — simply stops receiving orders, and the shop finds out days later from a customer or from a missing shipment. The webhook screen shows "disabled" and nothing explains when, or why, or how many times it has happened before.

This plugin is the missing half.

* Checks your webhooks on a schedule (every 15 minutes up to once a day).
* Records an incident for each one WooCommerce has switched off: topic, delivery URL, how many deliveries failed, and what was done about it.
* Sends **one digest e-mail per scan**, not one per webhook — a dead endpoint takes all its hooks down together, and twelve identical mails at 03:00 teach you to filter the sender rather than to fix the endpoint.
* Keeps the history, so three weeks later you can answer the question that actually matters: how long has this integration been flaky, and how often?

= Pro =

* **Switch it back on automatically** — after checking the endpoint is answering again.
* The check is a plain HEAD/GET, never a replay of the failed payload. Re-sending a real order webhook to an endpoint whose state is unknown is how a warehouse ships the same order twice.
* Reviving also **resets the failure counter**. A hook re-enabled with the count still at five dies again on its very next failure, which is the mistake most manual fixes make.
* **Flap guard**: a limit on how often a single webhook may be revived per day, so a hook whose endpoint is broken in a way the probe cannot see is not resurrected for ever, five real requests at a time.
* Longer incident retention.

= Privacy =

The plugin stores webhook metadata (id, name, topic, delivery URL, failure count) in its own table. It sends no data anywhere except the report e-mail to your own address, and the endpoint probe, which goes to the delivery URL you configured in WooCommerce.

== Installation ==

1. Install and activate. WooCommerce must be active.
2. Go to **Webhook Watchdog** in the admin menu.
3. Leave it on "Report only" for a few days to see what your shop actually does, then decide about reviving.

== Frequently Asked Questions ==

= Why does my webhook get disabled at all? =

WooCommerce increments a failure counter on every delivery that does not answer with a 2xx status. Past five (filterable through `woocommerce_max_webhook_delivery_failures`) it sets the webhook to disabled. A brief outage on the receiving side is enough.

= Will it re-send the deliveries that were lost? =

No, and deliberately so. WooCommerce does not keep the payloads of failed deliveries, and inventing replacements would be worse than the gap. The plugin restores delivery going forward and tells you the window you lost.

= Does it work with HPOS / custom order tables? =

Yes. The plugin never touches order tables directly and declares compatibility with both HPOS and the cart/checkout blocks.

== Changelog ==

= 1.0.0 =
* First release.
