WooCommerce
WooCommerce is the shop plugin for WordPress. Its webhooks call an address when an order is created and every time it is updated. Pointed at the Flows address, they start your flows: an order is placed, paid, completed or cancelled — and the customer gets the right message in Viber or SMS, with a reminder if the payment does not come.
This page is written from the public documentation of WooCommerce and has not been checked on a live account yet.
What you need
- WooCommerce itself is free: it is a WordPress plugin on your own hosting. Webhooks are part of it, in WooCommerce → Settings → Advanced → Webhooks, and you need access to these settings.
- Two webhooks — Order created and Order updated — with the same address. The type of the event travels in a header of the request, so one address serves both.
Step 1. Create a connection
- Open
Flows → Connections, press Connect a system and choose WooCommerce. - Press Copy address. It looks like
https://events.alphasms.net/hooks/<TOKEN>— keep it secret.
Step 2. Set up webhooks in WooCommerce
- Open WooCommerce → Settings → Advanced → Webhooks and press Add webhook.
- Name — what the webhook sends, for example "AlphaFlow — order created".
- Status — Active.
- Topic — Order created.
- Delivery URL — the address from the cabinet.
- Secret — leave it as it is (see Good to know).
- API Version — WP REST API Integration v3. The field is in the form, but the WooCommerce documentation does not name its values, so this choice is not confirmed by the documentation.
- Press Save webhook.
- Add the second webhook the same way: Name "AlphaFlow — order updated", Topic — Order updated, the same Delivery URL.
Do not use the topics of the Action type: they send only the name of an action and its argument, without a phone.
Step 3. Send a test
When you save a webhook with the status Active for the first time, WooCommerce sends a ping to the
Delivery URL. AlphaFlow accepts it and records nothing — no event and no refusal. Then place a test order with your
own phone number. The event appears in
Flows → Connections → Event journal, and the connection shows
Recognised: WooCommerce. WooCommerce keeps its own log of deliveries in WooCommerce → Status → Logs, source
webhooks-delivery.
Events
| WooCommerce webhook | AlphaFlow event | Properties |
|---|---|---|
| Order created | order_created | order_id, total, status |
Order updated, status processing with a payment date (date_paid) | order_paid | order_id, total, status |
Order updated, status processing without a payment date | order_status_changed | order_id, status |
Order updated, status completed | order_delivered | order_id, total, status |
Order updated, status cancelled | order_cancelled | order_id, total, status |
Order updated, status refunded | refund_issued | order_id, total, status |
Order updated, status failed | payment_failed | order_id, total, status |
| Order updated, any other status | order_status_changed | order_id, total, status |
Every event also carries currency, payment_method (the name of the payment method), first_name, last_name
and city (the city of delivery).
processingbecomesorder_paidonly when the order has a payment date (date_paid): an order paid on delivery also goes toprocessing, but unpaid, and comes asorder_status_changed. In WooCommercecompletedmeans that the order is fulfilled.- The statuses are matched by a table that you can correct in the connection. Statuses added by plugins (for
example, a "shipped" status of a delivery plugin) come as they are — add them to the table, for example as
order_shipped. - WooCommerce itself has no tracking number: delivery plugins keep it in their own fields, which the connection does not read.
The contact is found by the phone and the email of the billing address (billing.phone, billing.email) and by
the WooCommerce id of the customer (customer_id). For a guest order WooCommerce sends 0 instead of the id, so
such an order is matched by the phone and the email. The time of the event is the time the order was last modified
(date_modified_gmt, in UTC). The names of the events are the ones the ready-made templates expect — see
Recommended events.
Good to know
- WooCommerce delivers a webhook once, in the background (through wp-cron), and does not repeat it. An answer other
than
2xx,301or302counts as a failure; after more than five failures in a row WooCommerce disables the webhook (Status: Disabled), and it has to be switched on again by hand. - Order updated comes on any edit of an order, not only on a change of its status, and carries the current status. AlphaFlow records it once per status of the order: an edit that does not change the status is not a new event.
- WooCommerce signs every request with the Secret (the header
X-WC-Webhook-Signature). The signature is optional: the secret in the address is enough, and AlphaFlow checks the signature only if you copy the secret into the connection. - The address always answers
200. Above the daily event limit the event is refused in AlphaFlow withquota_exceededand shown in the journal; the webhook in WooCommerce stays on.