Recover abandoned Shopify carts with personalized push

When a shopper leaves checkout, we check their order history and send a push that names the item they left and matches how they shop.

Agentic Task
OneSignalShopifyGoogle SheetsMarketingSalesContent GenerationNotifications & Alerts
PromptCreate

Watch my Shopify store for new abandoned checkouts using the Shopify abandoned checkouts poll trigger, and try to recover each one with a personalized push instead of a generic blast. Process each abandoned checkout once.

Apply my filters before doing any other work. Skip the checkout if its total cart value is below CART_VALUE_THRESHOLD, which I will set (for example 40 in store currency). Skip it if I cannot identify the shopper, meaning there is no Shopify customer attached to the checkout, or that customer has no id I can use to reach them in OneSignal. Guest checkouts are expected to fall out here.

For checkouts that pass, look the shopper up in Shopify. Use Get Customer with the customer id on the checkout to pull their profile, then use Get Customer Orders to pull their order history. Use that history for two things. First, the anti nag check: if the shopper has any order created after the abandoned checkout timestamp, they already bought, so stop and send nothing. Second, classification: zero prior orders means first time visitor, and one or more prior orders means repeat buyer. For repeat buyers, note the items and the date of their most recent order.

Then write the push copy yourself, sized for a push notification: a title of roughly 40 characters and a body under roughly 120 characters. Always name the specific item left in the cart, taken from the abandoned checkout line items, and never fall back on a generic line like you left something in your cart. For a first time visitor, write a welcome style nudge that introduces the store warmly and uses BEST_SELLER_PRODUCT, which I will set, as social proof, along the lines of it being what most shoppers pick first. For a repeat buyer, write a loyalty framing that thanks them for coming back and references what they bought last time by name, connecting it to the item now sitting in the cart. Pick exactly one of these two angles per shopper.

Send the copy through OneSignal Create Message. Target only this one shopper: set include_aliases with alias label external_id and the shopper's Shopify customer id as the alias id. Do not set any other targeting method, such as included_segments, include_external_user_ids, or include_subscription_ids, because OneSignal accepts exactly one targeting method per message. Put the body in contents and the title in headings so this sends as a push. Set idempotency_key to a stable value derived from the abandoned checkout id and reuse that exact value on every retry, so a retry after a timeout or a rate limit can never send the same shopper a second recovery push. If OneSignal returns a 429, wait for the Retry-After value before retrying.

Finally, append one row per recovery attempt to my Google Sheet using Append Values, with these columns: timestamp, abandoned checkout id, shopper type (first time or repeat), cart value, the item left in the cart, the exact push copy that was sent, and the OneSignal message id. Also append a row for each checkout that was skipped, putting the skip reason (below threshold, already ordered, or unreachable shopper) in place of the copy, so the sheet shows both what went out and what got filtered. I want to compare over time which angle, welcome or loyalty, actually converts.

What does this prompt do?

  • Watches your Shopify store for abandoned checkouts and picks up each one within minutes, no manual export needed
  • Looks the shopper up in Shopify first, so a first time visitor and a loyal repeat buyer never get the same message
  • Writes fresh push copy that names the exact item left behind, then sends it to that one shopper through OneSignal
  • Skips small carts and anyone who already placed an order after leaving, so nobody gets nagged about a purchase they finished
  • Logs every attempt to a Google Sheet with the cart value, the copy sent, and the shopper type, so you can see which angle actually wins

What do I need to use this?

  • A Shopify store you can connect, with permission to read customers, orders, and abandoned checkouts
  • A OneSignal account with push already set up for your app or website
  • Shoppers identified in OneSignal by their Shopify customer ID, so we can reach exactly the right person instead of blasting a segment
  • A Google Sheet to collect the results, with a tab ready for the log
  • The name of your best selling product, used as social proof for first time shoppers
  • A minimum cart value worth chasing, for example 40 in your store currency

How can I customize it?

  • Raise or lower the minimum cart value so you only chase checkouts worth recovering
  • Swap the best seller you cite as social proof, or change it seasonally as your hero product changes
  • Adjust the tone and length of the two angles, the welcome nudge and the loyalty note, or add a discount line to one of them
  • Point the log at a different sheet or add columns, such as whether that shopper came back and bought

FAQs

Will someone get a push after they already bought?
No. Before writing anything, we check the shopper's Shopify orders for one placed after they left checkout. If they already completed a purchase, the workflow stops and sends nothing.
What happens with guest shoppers who are not in my push audience?
They are skipped, because there is no way to reach a specific person who was never identified. The skip is written to your sheet with the reason, so you can see how many checkouts fall into that bucket.
Could a technical hiccup send the same shopper two pushes?
No. Each recovery message carries a unique key tied to that one abandoned checkout, so if the send is retried the shopper still only ever receives it once.
Can it send an email or a text instead of a push?
Yes. OneSignal can send email and SMS as well as push, so you can ask for a different channel, or keep push as the fast first touch and follow up elsewhere.
Why use an agent instead of a fixed template?
Because the message is written per shopper. It reads the actual cart contents and past purchases, then decides whether a welcome framing or a loyalty framing fits, which a single fixed template cannot do.
Does this need a Shopify app or theme change?
No changes to your storefront. It reads your store data and sends through OneSignal. The one setup detail is making sure OneSignal knows each shopper's customer ID.

Related templates

Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client account

Stop recovering carts with a generic reminder blast.

Give every abandoned checkout a message that names the item and matches the shopper, and keep a running record of which angle brings people back.