Guides

Webhooks for Cart Recovery: Connect Zapier, Make and n8n

Send cart events to your favourite automation tools.

Webhooks for Cart Recovery: Connect Zapier, Make and n8n

Webhooks explained

What it does. Calls an external address the moment something happens in the store, so automations elsewhere can react.

Why it matters. Add the customer to a mailing list when a cart is abandoned, ping a chat channel when a cart is recovered, or keep a spreadsheet in sync — without touching code.

Details

The three events

Event Setting Fires when
abandoned Cart abandoned The engine marks a cart as abandoned — it has been quiet for Abandoned after minutes. Fires whether or not follow-up sending is switched on. Not fired for unsubscribed customers.
sent Message sent A follow-up has been handed over: email, SMS or WhatsApp, scheduled or sent with Send now. Not fired for the out-of-stock notice, for the weekly summary or for the “cart recovered” mail to the store.
recovered Cart recovered An order of the customer closes a cart that counts as recovered (see “How the numbers are counted” in 4.10). A cart closed by an order without a reminder before does not fire it.

Each event has its own URL under Settings → Webhooks. Leave one empty and that event is not sent.

How each request looks

  • POST to the URL, the body as JSON, header Content-Type: application/json.
  • Three more headers:
  • X-CartWin-Event — abandoned, sent or recovered.
  • X-CartWin-Delivery — a new unique id (UUID) for every request, to tell deliveries apart.
  • X-CartWin-Signature — sha256= followed by the HMAC-SHA256 of the request body, computed with the Signing secret from the settings. Leave the secret empty and CartWin uses a secret derived from the site instead. Enter a secret of your own so that you know it on the receiving side.
  • The body:

json
{
"event": "abandoned",
"time": "2026-11-27 14:03:00",
"site": "https://www.yoursite.com/",
"cart": {
"id": 1287,
"status": "abandoned",
"email": "[email protected]",
"phone": "+15550100222",
"first_name": "Anna",
"last_name": "Brown",
"user_id": 0,
"total": 84.5,
"currency": "USD",
"items": [
{ "product_id": 61, "variation_id": 0, "name": "Blue T-shirt", "quantity": 2 }
],
"captured_at": "2026-11-27 13:41:10",
"abandoned_at": "2026-11-27 13:56:10",
"recovered": false,
"recovered_order_id": 0,
"recovered_total": 0,
"checkout_url": "https://www.yoursite.com/?cartwin_restore=…"
},
"message": null
}

  • time, captured_at and abandoned_at are in UTC, not in the store’s time zone.
  • message is filled in for sent only: { "id": 4412, "channel": "email", "template_id": 3, "title": "Did you forget something?", "coupon_code": "CARTWIN-8F2K" }. channel is email, sms or whatsapp.
  • Items carry product_id, variation_id, name and quantity — no prices.
  • The secret cart token is not included, but checkout_url is the customer’s restore link: anyone who has it can put that cart back together. Enter webhook addresses of services you trust only.

Checking the signature on the receiving side

Compute the HMAC-SHA256 of the raw request body with the signing secret and compare it with the part after sha256= in the X-CartWin-Signature header. In PHP:

$given  = $_SERVER['HTTP_X_CARTWIN_SIGNATURE'] ?? '';
$expect = 'sha256=' . hash_hmac( 'sha256', file_get_contents( 'php://input' ), $secret );
if ( ! hash_equals( $expect, $given ) ) {
    http_response_code( 401 );
    exit;
}

What CartWin does with the answer

  • One attempt only. There is no retry and no queue: an automation misses the event when its address cannot be reached at that moment.
  • Time-out 8 seconds; redirects are not followed.
  • Only a failed connection counts as a failure — time-out, DNS error, connection refused, an unusable address. It is written to the activity log as “Webhook delivery failed: …”. The engine goes on regardless.
  • An error answer is not noticed. When the receiving server answers with HTTP 4xx or 5xx, CartWin still treats the delivery as done: nothing is logged, and the message or the cart is unaffected. When a webhook does not arrive, look in the history of the automation tool (Zapier, Make, n8n …) first.
  • Any http or https address is accepted, also one inside your own network. CartWin does not block private addresses.

Automation tools

  • Zapier, Make, n8n and OttoKit can all receive these requests: start the automation with a “Webhook” or “HTTP request” trigger (method POST). Then map the fields from the JSON body, for example cart.email, cart.phone, cart.total, cart.checkout_url, cart.items[0].name.
  • Typical uses: add the contact to a mailing list (abandoned), post to a chat channel (recovered), create a lead in a CRM (abandoned), write a row into a spreadsheet (recovered).

Where to find it. Settings → Webhooks. Details for developers: chapter 15.

Set up webhooks

  1. In your automation tool, create an automation that starts with a webhook trigger and copy the URL it gives you.
    – Zapier: trigger Webhooks by Zapier → Catch Hook
    – Make: module Webhooks → Custom webhook
    – n8n: node Webhook
    – OttoKit: trigger Webhook
  2. Under CartWin → Settings → Webhooks, paste the URL next to the event you want: Cart abandoned, Message sent or Cart recovered. Save.
  3. Abandon a test cart (or click Run the engine now under Tools once one is abandoned) and look at the data that arrives.

What arrives — a JSON POST with these headers:

Header Value
Content-Type application/json
X-CartWin-Event abandoned, sent or recovered
X-CartWin-Delivery A unique id for this delivery
X-CartWin-Signature sha256= followed by the HMAC-SHA256 of the body

Example payload (cart recovered):

{
  "event": "recovered",
  "time": "2026-11-27 10:15:04",
  "site": "https://your-store.com/",
  "cart": {
    "id": 128,
    "status": "completed",
    "email": "[email protected]",
    "phone": "",
    "first_name": "Alex",
    "last_name": "Sample",
    "user_id": 0,
    "total": 89.5,
    "currency": "USD",
    "items": [
      { "product_id": 51, "variation_id": 0, "name": "Blue T-shirt", "quantity": 2 }
    ],
    "captured_at": "2026-11-26 09:12:40",
    "abandoned_at": "2026-11-26 09:27:40",
    "recovered": true,
    "recovered_order_id": 2401,
    "recovered_total": 89.5,
    "checkout_url": "https://your-store.com/?cartwin_restore=…"
  },
  "message": null
}

Verifying the signature (when a secret is set). The signature is sha256= + HMAC-SHA256 of the raw request body, using the signing secret:

const crypto = require('crypto');

function verify(rawBody, signatureHeader, secret) {
  const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
  const given = String(signatureHeader || '');
  return given.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
}

Leave Signing secret empty and the signature is made with a secret derived from your site — still consistent, but only known to this site.

Good to know

  • The Cart abandoned event also fires while Send follow-ups is switched off. Leave its URL empty until you want the automation to run for real.
  • The Message sent event fires for every channel — email, SMS and WhatsApp — and also for a message sent with Send now. The out-of-stock notice does not fire it.
  • The Cart recovered event fires only for carts that count as recovered, that is, when a reminder or the restore link came before the order.
  • Each request is tried once, with an 8-second time-out. Make the receiving side answer quickly — store the data first, work later.
  • CartWin only logs a failed connection. An error answer from the receiving side (HTTP 4xx or 5xx) is not noticed by CartWin: when an automation did not run, look in the history of the automation tool first.
  • The times in the payload are in UTC. Convert them to your time zone in the automation.
  • The payload holds the customer’s email address, phone number and restore link. Only enter addresses of services you trust, and do not paste a payload into a ticket or a public chat.

Webhooks FAQ

What is a webhook?
A call from one program to another at a given address, made the moment something happens. CartWin calls an address you choose when a cart is abandoned, a message is sent or a cart is recovered.

What can I do with it?
Anything an automation tool can do with that information: add the customer to a mailing list, create or update a lead in a CRM, post a note in a chat, write a row in a spreadsheet, start a follow-up sequence in another tool.

Which tools can receive the calls?
Any service that can take an HTTP POST with JSON. Zapier, Make, n8n and OttoKit are common choices; each has a “Webhook” trigger for it.

How do I set one up?
Create the automation in the tool, copy the address of its webhook trigger, paste it under Settings → Webhooks next to the event, and save (10.5).

Which events are there?
Three, each with its own address:
– Cart abandoned — the engine marks a cart as abandoned.
– Message sent — a follow-up was handed over, on any channel.
– Cart recovered — an order closed a cart that counts as recovered.

Does “Cart abandoned” also fire while sending is switched off?
Yes. The event belongs to the tracking, not to the sending. Leave its address empty until you want the automation to run for real.

Is a failed call tried again?
No. Each event is tried once, with a time-out of 8 seconds. An automation that is offline at that moment misses the event.

My webhook does not arrive. Why?
Check in this order:
– The history of the automation tool: it shows whether the call arrived and whether the tool answered with an error. CartWin does not notice an error answer.
– Tools → Activity log, search for “webhook”: “Webhook delivery failed: …” means the address could not be reached at all.
– The address: it must be a complete https:// address, saved under the right event.

How do I check that a call really comes from my store?
Enter a Signing secret and check the X-CartWin-Signature header on the receiving side: sha256= followed by the HMAC-SHA256 of the request body, computed with that secret (code in 4.12).

What data is in a call?
The event, the time (UTC), the site address, and the cart: email address, phone number, name, value, currency, items, times, recovery details and the customer’s restore link — plus the message for Message sent. No prices per item, no password, no API key. Because it holds contact details and a working restore link, only enter addresses of services you trust.

Can several tools get the same event?
Not directly: one address per event. Let the first tool pass the event on, or have a developer add a second call (chapter 15).

Do the calls slow down the sending?
Each call waits up to 8 seconds for an answer. A slow receiving side can make an engine run take longer; keep the endpoint quick.


Get started for free

CartWin is free, open source, and runs on your own WordPress site. Download CartWin from WordPress.org.

Questions? Write to [email protected].