How it works
- WooCommerce sends a POST request to your Nango webhook URL when a subscribed store event occurs, for example
order.created. - Nango looks up the connection named by the
nangoConnectionIdquery param on the webhook URL and verifies the delivery’sX-WC-Webhook-Signatureagainst that connection’s own webhook secret. - Nango routes the event to that connection, using the
X-WC-Webhook-Topicheader as the webhook type.
webhookSecret in Nango. Deliveries without a valid signature are rejected.
Setup
1. Get your Nango webhook URL
In the Nango dashboard, open your WooCommerce integration and copy the Webhook URL. Append?nangoConnectionId=<CONNECTION-ID> for the connection you are registering the webhook for. URL-encode the connection ID if it contains characters like /, : or spaces.
2. Pick a webhook secret
Generate a random secret for the connection, for example withopenssl rand -hex 32. You use the same value in the store and in Nango.
3. Register the webhook in WooCommerce
- WooCommerce admin
- WooCommerce API
- In the WordPress admin, go to WooCommerce → Settings → Advanced → Webhooks and select Add webhook.
- Set Status to Active and pick a Topic, for example Order updated.
- Set Delivery URL to the URL from step 1.
- Set Secret to the secret from step 2.
- Save. WooCommerce pings the URL once, and Nango answers it without routing anything.
4. Set the webhook secret in Nango
Store the same secret aswebhookSecret in the connection’s metadata:
The webhook secret on the integration’s Settings page is not used for WooCommerce. Nango only verifies against the connection’s
webhookSecret.Handle the webhook
Once routed, you have two options:- Forward it to your app: Nango forwards the event to your webhook URL with connection attribution. See External webhook forwarding.
- Process it in a sync: run a sync when the webhook arrives using
webhookSubscriptionsandonWebhook. Subscribe to topics likeorder.updatedorproduct.deleted. See Real-time syncs.
Rollback strategy
Delete the webhook in WooCommerce → Settings → Advanced → Webhooks, or with the API:webhookSecret from the connection’s metadata.