Makani Tech: Build. Automate. Evolve.

Abandoned Cart Recovery on WhatsApp with n8n + Claude (free workflow)

How to win back abandoned carts on WhatsApp without giving away discounts

FreeWorkflowBy Kishan Makani · updated 19 October 2026 · 7 min read

ShopifyWhatsAppClaudeGoogle Sheets

Downloads

  • Download the n8n workflow (JSON)

    abandoned-cart-whatsapp-n8n-claude.json · n8n workflow · 19 steps · starts with Every 30 minutes · uses Anthropic, Slack, WhatsApp, Google Sheets · 32 KB

    Import into n8n: Create Workflow, then the menu, then Import from File.

How to import it into n8n
  1. In n8n, create a new workflow.
  2. Open the ⋯ menu at the top right and choose Import from File, then pick the downloaded .json. (Or open the file, copy everything and paste it on the canvas.)
  3. Open each node with a warning and connect your own account: the file carries no passwords or keys.
  4. Run it once with Test workflow, check the result, then switch it to Active.

What it does

Every 30 minutes the workflow asks Shopify for checkouts started 1 to 3 hours ago that were never paid. Each cart is cleaned up, and only carts with a valid Indian mobile number and marketing consent go on. A guard makes sure no cart is ever messaged twice. One cart at a time, n8n checks whether the customer has ordered since (another tab, another device, COD) and skips them if so. Claude writes one friendly phrase about what is in the cart, with no fake urgency. Normal carts get a plain WhatsApp template with the checkout link. Carts above Rs 3,000 come to Slack first, where you decide whether to add a 5% code. Every reminder is logged in Google Sheets.

Who it is for

Shopify and D2C brands in fashion, beauty, home and food, where a good share of carts stop at the payment page and the only follow-up is a default email.

What you need

  • An n8n account (n8n Cloud or self-hosted)
  • A Shopify store and a custom app Admin API token with read_checkouts and read_orders
  • A WhatsApp Business Cloud number with two approved Marketing templates
  • An Anthropic API key for Claude
  • Slack (#carts) and a Google Sheet
  • A discount code (for example COMEBACK5) created in Shopify Discounts

How the workflow runs, node by node

The slides show the same steps. Open the workflow in n8n and you will see a sticky note over each one.

Step 1 · Find carts left for an hour

Every 30 minutes n8n asks Shopify for checkouts started 1 to 3 hours ago that were never paid, and splits them into one row per cart.

  • Every 30 minutes: Runs every 30 minutes.
  • Get abandoned checkouts: Asks the Shopify Admin API for open (unpaid) checkouts started between 1 and 3 hours ago. Uses a custom app token with read_orders access.
  • One row per cart: Turns Shopify's list into one item per abandoned checkout.

Step 2 · Only people you may message

Each cart is cleaned up: first name, phone with 91, items and total. Carts with no valid mobile number or no marketing consent are dropped, and no cart is ever messaged twice.

  • Clean cart: Keeps first name, email, phone (with 91), cart total, items with size, the recovery link, the time and whether they accepted marketing.
  • Reachable and opted in?: Keeps only carts with a valid Indian mobile number, marketing consent ticked at checkout, and no completed payment.
  • Not messaged before: Remembers every checkout id it has handled. Each cart gets one reminder at most, even though the 1 to 3 hour window overlaps between runs.

Step 3 · Check they didn't just buy

One cart at a time, n8n asks Shopify for any order from the same customer since the cart was started. Bought on another tab, or by COD? No message.

  • One cart at a time: Handles one cart per loop, so each cart gets its own order check and, if needed, its own approval.
  • Ordered since?: Checks Shopify for any order from the same email since the cart was started (another tab, COD, or a different device).
  • Still not ordered?: True only when the customer has not ordered since. Anyone who already bought goes straight back to the loop, with no message.

Step 4 · Claude writes a friendly nudge

Claude writes one short, human line about what is in the cart, like 'the two cotton kurtas in size M'. No fake urgency, no 'only 2 left'. Carts above ₹3,000 are marked as big.

  • Write nudge with Claude: Writes one friendly phrase about what is in the cart ('the two cotton kurtas in size M') for the WhatsApp template, plus a preview. No fake urgency, no invented offers.
  • Claude: Claude (claude-sonnet-5-5) at temperature 0.4, so answers stay consistent from run to run.
  • Nudge schema: Forces fixed fields (product_phrase, big_ticket, preview). The phrase is capped at 60 characters so it fits the template.
  • Big cart?: True for carts of Rs 3,000 or more (change the number). Only these can get a discount, and only if you approve.

Step 5 · Discount only if you say so

Normal carts get a plain WhatsApp reminder with the checkout link. Big carts come to Slack first: tap 'Add 5% code' and they get the offer, skip it and they get the plain reminder. Everything is logged.

  • Approve discount: Posts big carts to #carts with items, total and the reminder text, and asks if a 5% code should be added. No answer in 2 hours means the plain reminder.
  • Approved?: True only when you tapped 'Add 5% code'.
  • Send with discount: Sends your approved 'cart_reminder_offer' WhatsApp template with name, cart phrase, the code and the checkout link. Error output goes to the alert.
  • Send cart reminder: Sends your approved 'cart_reminder' WhatsApp template with name, cart phrase and checkout link. No discount. Error output goes to the alert.
  • Log recovery: Logs every reminder in the Cart reminders tab, keyed on Checkout ID, with cart, total and whether a code was given.
  • Alert owner: Tells you in Slack if WhatsApp refused a reminder (often a template or number problem), then carries on with the next cart.

Setup

  1. In n8n, create a new workflow, open the menu and choose Import from File, then pick the JSON file.
  2. In Shopify, go to Settings > Apps and sales channels > Develop apps, create an app with the read_checkouts and read_orders scopes, install it and copy the Admin API access token. Put it and your store name in Get abandoned checkouts and Ordered since?.
  3. At checkout, make sure the marketing consent checkbox is shown, and add a line saying you may send order and cart reminders on WhatsApp.
  4. In WhatsApp Manager, create two Marketing templates: cart_reminder (name, cart phrase, link) and cart_reminder_offer (name, cart phrase, code, link). Wait for approval.
  5. Connect WhatsApp on both send nodes and set your Phone number ID.
  6. Create an Anthropic credential on Claude and replace YOUR_BRAND in Write nudge with Claude.
  7. Make a Google Sheet with a Cart reminders tab (Checkout ID, Sent at, Name, Phone, Cart, Total, Offer, Status) and paste its URL in Log recovery. Connect Slack on Approve discount and Alert owner.
  8. Create the code COMEBACK5 in Shopify Discounts (one use per customer). Abandon a checkout with your own number, wait an hour, run the workflow and check the message.

How to customise it

  • Change the Rs 3,000 big-cart limit in Big cart?, or the discount code and percentage.
  • Change the window (1 to 3 hours) in Get abandoned checkouts. Fashion often works at 1 hour, furniture at 24.
  • Add a second reminder after 24 hours for big carts only, with a new checkout window and its own guard.
  • Mark carts as Recovered: a second workflow on Shopify's orders/create topic can update the row by email.
  • Use Hindi templates for customers whose shipping state suggests it, with a language column in the sheet.

Guardrails

No discount goes out unless you tap Approve. People without marketing consent are never messaged.

  • Only customers who ticked marketing consent are messaged, and each cart gets one reminder at most.
  • No discount code goes out without your tap. No answer in 2 hours sends the plain reminder.
  • Customers who already ordered (on another tab, device or by COD) are never chased.
  • Claude is told never to invent urgency, stock levels, prices or offers.
  • Both messages are Meta-approved templates, as WhatsApp requires for messages outside a 24 hour chat.

Troubleshooting

  • Get abandoned checkouts returns 401 or 403. The token is wrong or the app lacks the read_checkouts / read_orders scopes. Reinstall the app after changing scopes.
  • No carts ever pass the filter. Phones may be stored without 91 or with spaces. Check Clean cart, and check customers are ticking the consent box.
  • WhatsApp error 132000 or template not found. The template name, language and number of variables must match exactly what Meta approved.
  • The loop stops after one cart. Every path (sent, skipped, alert) must connect back to One cart at a time.
  • Customers get the plain reminder even though you approved. The approval must arrive within 2 hours. Increase the wait in Approve discount if you check Slack less often.

Want the members-only resources too?

A free account unlocks them all, including the ones shared in DMs.

Create a free account