E-commerce · n8n

Recover Lost Sales by Syncing Shopify Abandoned Carts to ActiveCampaign Automatically

When a customer abandons their cart in Shopify, this workflow instantly adds or updates them in ActiveCampaign and triggers your abandoned cart email automation. Stop losing revenue to forgotten checkouts without any manual effort.

difficulty Intermediatesetup 45 minresult Every Shopify abandoned cart event automatically creates or updates a contact in ActiveCampaign and fires your recovery email sequence within seconds.
  1. 1

    Catch the Shopify Abandoned Checkout Webhook

    Add a Webhook node as your trigger. Set the HTTP Method to POST and copy the generated webhook URL. In your Shopify admin go to Settings > Notifications > Webhooks and create a new webhook for the Checkout abandoned event, pasting your n8n URL as the destination. Every time a cart is abandoned, Shopify will POST the checkout data to this node.

  2. 2

    Extract and Format the Contact Data

    Add a Set node connected to the webhook. Create fields named email mapped to {{$json.body.email}}, firstName mapped to {{$json.body.billing_address.first_name}}, lastName mapped to {{$json.body.billing_address.last_name}}, and cartValue mapped to {{$json.body.total_price}}. This flattens the nested Shopify payload into clean fields for ActiveCampaign.

  3. 3

    Check if an Email Address Exists

    Add an IF node to guard against carts with no email address. Set the condition to check that {{$json.email}} is not empty. Connect the TRUE branch to the next step. This prevents failed API calls when a visitor abandons a cart before entering their email.

  4. 4

    Create or Update the Contact in ActiveCampaign

    Add an HTTP Request node on the TRUE branch. Set Method to POST and URL to https://YOUR_ACCOUNT.api-us1.com/api/3/contact/sync. Under Authentication choose Header Auth and add header Api-Token with your ActiveCampaign API key from your account settings. Set Body Content Type to JSON and paste the body: {"contact": {"email": "{{$json.email}}", "firstName": "{{$json.firstName}}", "lastName": "{{$json.lastName}}", "fieldValues": []}}. This upserts the contact so no duplicates are created.

  5. 5

    Add the Contact to Your Abandoned Cart Automation

    Add a second HTTP Request node. Set Method to POST and URL to https://YOUR_ACCOUNT.api-us1.com/api/3/contactAutomations. Use the same Api-Token header. Set the JSON body to {"contactAutomation": {"contact": "{{$json.contact.id}}", "automation": "YOUR_AUTOMATION_ID"}}. Replace YOUR_AUTOMATION_ID with the numeric ID found in ActiveCampaign under Automations > edit your abandoned cart automation and check the URL. This enrolls the contact and fires your recovery email sequence immediately.

Frequently asked questions

How do I find my ActiveCampaign automation ID?

Open ActiveCampaign, go to Automations, click to edit your abandoned cart automation, and look at the URL in your browser. It will contain a number like `/automations/42/edit` — that number (42 in this example) is your automation ID.

What if the customer already exists in ActiveCampaign?

The `/contact/sync` endpoint used in Step 4 is an upsert — it updates the contact if the email already exists and creates a new one if it does not. You will not end up with duplicate contacts.

Will this trigger the automation multiple times if the same person abandons a cart again?

ActiveCampaign will re-enroll the contact only if your automation has re-entry enabled. Go to your automation settings in ActiveCampaign and toggle on `Allow contacts to enter this automation more than once` if you want repeat abandoned carts to trigger a new email sequence.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.