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.
- 1
Catch the Shopify Abandoned Checkout Webhook
Add a
Webhooknode as your trigger. Set theHTTP Methodto POST and copy the generated webhook URL. In your Shopify admin go to Settings > Notifications > Webhooks and create a new webhook for theCheckout abandonedevent, pasting your n8n URL as the destination. Every time a cart is abandoned, Shopify will POST the checkout data to this node. - 2
Extract and Format the Contact Data
Add a
Setnode connected to the webhook. Create fields namedemailmapped to{{$json.body.email}},firstNamemapped to{{$json.body.billing_address.first_name}},lastNamemapped to{{$json.body.billing_address.last_name}}, andcartValuemapped to{{$json.body.total_price}}. This flattens the nested Shopify payload into clean fields for ActiveCampaign. - 3
Check if an Email Address Exists
Add an
IFnode 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
Create or Update the Contact in ActiveCampaign
Add an
HTTP Requestnode on the TRUE branch. SetMethodto POST andURLtohttps://YOUR_ACCOUNT.api-us1.com/api/3/contact/sync. UnderAuthenticationchooseHeader Authand add headerApi-Tokenwith your ActiveCampaign API key from your account settings. SetBody Content Typeto 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
Add the Contact to Your Abandoned Cart Automation
Add a second
HTTP Requestnode. SetMethodto POST andURLtohttps://YOUR_ACCOUNT.api-us1.com/api/3/contactAutomations. Use the sameApi-Tokenheader. Set the JSON body to{"contactAutomation": {"contact": "{{$json.contact.id}}", "automation": "YOUR_AUTOMATION_ID"}}. ReplaceYOUR_AUTOMATION_IDwith 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.