=== BotBee Webhook Automation for WooCommerce ===
Contributors: botbee
Tags: woocommerce, webhook, automation, abandoned cart, shipment tracking
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.3.0
Requires PHP: 8.1
WC requires at least: 7.0
WC tested up to: 9.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce with WhatsApp, AI agents, CRMs, and advanced webhook automations using BotBee.

== Description ==

**BotBee FlowBridge** is an enterprise-grade WooCommerce webhook and automation engine. Connect your store to any external system — WhatsApp, CRM, AI agents, ERP, marketing tools — using powerful, configurable webhooks with conditions, delays, retries, and a complete delivery log.

**Key Features:**

= Webhook Engine =
* WooCommerce order events: created, processing, completed, cancelled, refunded, failed, on-hold, updated, notes added
* Payment events: payment complete, payment failed, COD order placed
* Customer events: registered, updated, deleted, first purchase
* Abandoned cart events (multi-stage)
* Shipment tracking event: `order.shipped` fires when tracking info is added to an order
* Review request event: `review.request` fires when a review invitation is scheduled
* Per-webhook: custom URL, HTTP method (POST/GET/PUT/PATCH), custom headers, secret token
* HMAC SHA256 signature on every delivery (`X-BotBee-Signature: sha256=HASH`)
* JSON payload templates with `{{variable.path}}` placeholders
* Conditions engine: filter by payment method, order total, country, SKU, customer role, and more
* Per-webhook delay (0 to any seconds)
* Configurable retry system with custom retry intervals

= Async Queue System =
* Every webhook is queued and delivered asynchronously — **never slows down checkout**
* Queue processes every minute via WP-Cron
* Automatic retry on failure

= Advanced Abandoned Cart System =
* Tracks both logged-in users and guests (via session/email/phone capture)
* Configurable multi-stage abandonment timing — any number of stages, any time in minutes
* Generates secure one-click recovery URLs to restore cart
* Events fire per-stage: `abandoned_cart.created`, `abandoned_cart.stage_2`, `abandoned_cart.stage_3`, ...
* Marks cart as recovered automatically when an order is placed
* Auto-expires carts after a configurable number of days
* Full admin view with customer email, phone, cart total, stage, and recovery URL

= Shipment Tracking =
* Add tracking info directly from the WooCommerce order screen (tracking number, carrier, date, notes)
* Supports 18 major carriers including FedEx, UPS, DHL, USPS, Aramex, Blue Dart, and more
* "Mark as Shipped" option sets the order to a custom Shipped status
* `order.shipped` webhook fires automatically with full tracking payload
* Shipping analytics dashboard: total shipments, tracking coverage, average fulfilment time, carrier breakdown

= Review Requests =
* After a configurable number of days from a chosen order status, a `review.request` webhook fires
* Webhook payload includes a one-time secure review link
* Customer clicks the link and lands on a branded review page with star ratings for each product
* Ratings and comments are submitted directly to WooCommerce product reviews
* Token is generated immediately when the order reaches the trigger status — URL visible in admin right away
* Review Requests admin page: view all scheduled, sent, and completed requests with copy-to-clipboard links

= Delivery Logs =
* Complete log of every webhook delivery: request payload, response body, HTTP status, duration
* Filter by status and event type
* Manual resend button per log entry
* Configurable log retention with auto-cleanup

= Test Center =
* Send sample payloads to any URL directly from the admin
* Live payload preview per event type
* See real HTTP response code and body

= WordPress.org Ready =
* GPL-2.0+ licensed — no proprietary code
* HPOS (High-Performance Order Storage) compatible
* WooCommerce Blocks Checkout compatible
* Follows WordPress Coding Standards

Use cases include WhatsApp automation, CRM sync, AI agents, ERP integration, Google Sheets, COD confirmation flows, shipment notifications, post-purchase review collection, and internal workflow automation.

== Installation ==

1. Upload the `botbee-flowbridge` folder to the `/wp-content/plugins/` directory, or install directly from the WordPress plugin admin.
2. Activate the plugin through the **Plugins** menu.
3. Ensure WooCommerce is installed and active.
4. Go to **FlowBridge** in the WordPress admin menu to configure your webhooks.

== Frequently Asked Questions ==

= Does this slow down my checkout? =
No. All webhooks are queued and delivered asynchronously via WP-Cron, completely separate from the checkout process.

= How does HMAC signature verification work? =
When you set a secret token on a webhook, each delivery includes an `X-BotBee-Signature: sha256=HASH` header. The hash is `HMAC-SHA256(request_body, your_secret)`. Your receiving system can verify it to confirm the request came from your store.

= Can I send webhooks only for COD orders? =
Yes. Use the Conditions engine: set `field=payment_method`, `operator==`, `value=cod`.

= How does abandoned cart tracking work for guests? =
Guest carts are tracked by session ID. When a guest fills in their email or phone on the checkout page, those details are captured and stored with their cart. Abandonment events fire with all available contact information.

= How does the review request link work? =
When an order reaches your configured trigger status, the plugin immediately generates a secure one-time token. After your configured delay (default: 1 day), the `review.request` webhook fires with a link to a branded review page. The customer submits star ratings and comments for each product. Each link works only once.

= How do I add shipment tracking? =
Open any WooCommerce order in the admin. You will see a Shipment Tracking meta box. Click "Add Tracking Info", enter the tracking number, carrier, and optional shipped date, then save. The `order.shipped` webhook fires automatically.

= What carriers are supported? =
FedEx, UPS, DHL Express, USPS, Royal Mail, Australia Post, Canada Post, TNT, Aramex, J&T Express, Blue Dart, India Post, Delhivery, Ekart, DTDC, Ecom Express, Xpressbees, and a custom "Other" option.

== Screenshots ==

1. Dashboard with delivery stats
2. Webhook list with quick enable/disable toggles
3. Webhook editor with conditions and payload template
4. Delivery logs with resend functionality
5. Abandoned cart management with recovery URLs
6. Test Center — send live sample payloads
7. Settings — configure abandoned cart stages and review request trigger
8. Shipment tracking meta box on the order screen
9. Shipping analytics dashboard
10. Review Requests admin page with copy-to-clipboard links

== Changelog ==

= 1.3.0 =
* Added Shipment Tracking: add tracking info from the order screen, `order.shipped` webhook, shipping analytics dashboard
* Added Review Requests: scheduled one-time review links, `review.request` webhook, branded review page, admin table with copy links
* Added custom Shipped order status
* Review request token now generated immediately when the order reaches the trigger status
* Admin footer shows "Powered by BotBee AI Labs" on plugin pages

= 1.2.0 =
* Abandoned cart: multi-stage timing with configurable intervals
* Guest cart tracking via session, email, and phone capture
* Secure one-click cart recovery URLs

= 1.1.0 =
* HMAC SHA256 outbound signature on all webhook deliveries
* Conditions engine: filter webhooks by payment method, order total, country, SKU, customer role
* Per-webhook delay and retry configuration

= 1.0.0 =
* Initial release — webhook engine, async queue, delivery logs, Test Center

== Upgrade Notice ==

= 1.3.0 =
Adds shipment tracking and review request features. Two new database tables (botbee_shipments and botbee_review_requests) are created automatically on upgrade.

= 1.0.0 =
Initial release.
