Schedule icon
Request icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon

WooCommerce Order Health Sentinel

Read recent WooCommerce orders every hour, change nothing, and alert Slack when checkout failures spike or paid orders sit unshipped.

Categories
Business

A WooCommerce store can break quietly: a payment gateway plugin update, an expired API key or a bank outage turns checkouts into failed orders, and paid orders can sit in processing because nobody picked them. The store owner usually notices from an angry customer. This blueprint turns a scheduled, read-only call to the WooCommerce REST API into a store health gate: io.kestra.plugin.core.http.Request reads the newest orders, one jq query works out the failed share of checkout attempts, the worst payment method and the paid orders stuck in processing, and the result routes to a quiet log or a Slack alert.

How it works

  1. list_orders (io.kestra.plugin.core.http.Request) calls GET /wp-json/wc/v3/orders for the 100 newest orders, using HTTP basic auth with the REST API consumer key and secret over HTTPS. WooCommerce applies after in the store's own time zone, so the request asks for an extra 24 hours and the exact window is applied on date_created_gmt in the next step. It is a read: no order is changed.
  2. summarize_orders (io.kestra.plugin.core.debug.Return) first guards for a missing or non-200 response (UNREACHABLE). Otherwise one jq query keeps orders created in the last lookback_hours (UTC), treats failed, processing, on-hold, completed and refunded as checkout attempts (pending and cancelled are usually abandoned checkouts), computes the failed share and the payment method with the worst share, and counts processing orders older than max_processing_hours. With at least min_attempts attempts, a failure rate at or above critical_failure_rate is CRITICAL; at or above warning_failure_rate, or any stuck order, is WARNING; too few attempts is LOW_VOLUME; otherwise HEALTHY.
  3. route_by_order_health (io.kestra.plugin.core.flow.Switch) branches on that classification: HEALTHY and LOW_VOLUME log quietly, WARNING posts a Slack note, CRITICAL and UNREACHABLE page Slack. A defaults fallback logs anything unexpected.
  4. log_audit_result (io.kestra.plugin.core.log.Log) writes one audit line per run with the HTTP status and the full summary.
  5. The flow-level errors block pages Slack if the flow itself fails.
  6. The hourly_check trigger runs at quarter past every hour and ships disabled: true.

What you get

  • An hourly, read-only check of checkout and fulfilment health with no custom scripting and no extra plugin to install.
  • A status output (HEALTHY / WARNING / CRITICAL / LOW_VOLUME / UNREACHABLE) other flows can gate on, for example to pause ads while checkout is broken.
  • Slack messages that name the failing payment method and the number of paid orders waiting to ship.
  • An audit line on every run, separate from Slack.

Who it's for

  • Small and mid-size online stores on WooCommerce, including the many Indian stores using Razorpay, PayU, Cashfree or cash on delivery through WooCommerce plugins.
  • Store owners and operations teams who want to hear about a broken checkout within the hour.
  • Agencies running several client stores who want the same check on each one.

Why orchestrate this with Kestra

WooCommerce emails the admin per failed order, which is easy to ignore and says nothing about a rate. Kestra turns a plain, read-only REST call into a scheduled, typed classification with retries, a failure path and an execution history, and one flow per store keeps an agency's whole portfolio in one place.

Prerequisites

  • A WooCommerce store served over HTTPS with pretty permalinks enabled (required for /wp-json/).
  • REST API keys with Read permission from WooCommerce > Settings > Advanced > REST API.
  • A Slack incoming webhook for the WARNING, CRITICAL, UNREACHABLE and flow-failure alerts.

Secrets

  • WOOCOMMERCE_STORE_URL: the store's base URL, for example https://shop.example.com, without a trailing slash.
  • WOOCOMMERCE_CONSUMER_KEY: the REST API consumer key (ck_...).
  • WOOCOMMERCE_CONSUMER_SECRET: the REST API consumer secret (cs_...).
  • SLACK_WEBHOOK: Slack incoming webhook used for every alert branch and the flow-failure alert.

In Kestra OSS, secrets are supplied as environment variables prefixed SECRET_ and base64-encoded, for example SECRET_WOOCOMMERCE_STORE_URL=$(echo -n 'https://shop.example.com' | base64), and read back with {{ secret('WOOCOMMERCE_STORE_URL') }}. Use the Enterprise secrets backend for encryption at rest and access control.

Quick start

  1. Run a local WordPress with WooCommerce (for example the official wordpress Docker image plus the WooCommerce plugin), enable pretty permalinks and create Read-only REST API keys.
  2. If Kestra runs in Docker, attach the WordPress container to Kestra's network so the store URL resolves: docker network connect YOUR_KESTRA_NETWORK <wordpress_container>.
  3. Create a few test orders, set some to Failed and leave one in Processing, then run the flow manually with a low min_attempts and check status.
  4. Point the secrets at the live store and enable hourly_check.

How to extend

  • Page through busy hours with the page parameter when more than 100 orders arrive in the window.
  • Add a second Request for GET /wp-json/wc/v3/system_status to alert on outdated templates or a failing cron.
  • Store the last status in a KV store and alert only when it changes.
  • Split thresholds by payment method, for example a looser line for cash on delivery.

Inputs

  • lookback_hours: type INT, default 48.
  • warning_failure_rate: type FLOAT, default 10.0 (percent).
  • critical_failure_rate: type FLOAT, default 25.0 (percent).
  • min_attempts: type INT, default 10.
  • max_processing_hours: type INT, default 24.

Outputs

  • status: one of HEALTHY, WARNING, CRITICAL, LOW_VOLUME, UNREACHABLE.
  • Example path: {{ fromJson(outputs.summarize_orders.value).stuck_processing }} for the number of stuck paid orders.

Links

Pitfalls

  • Only the 100 newest orders are read; a store with more than 100 orders in lookback_hours + 24 hours needs paging, and stuck-order detection only sees orders inside that page.
  • Some security plugins and hosts block /wp-json/ or strip the Authorization header; that shows up as UNREACHABLE with HTTP 401 or 403.
  • Stores that mark cash on delivery orders as processing until delivery will see them as stuck; raise max_processing_hours or exclude that method in the jq query.
  • This flow only reads; it never changes an order.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.