{
  "id": "LwLAtwmNR9IIjegt",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Follow up on abandoned carts with WhatsApp and Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "979439a4-3a62-4aa0-bfea-49ee848bf651",
      "name": "Template Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -112
      ],
      "parameters": {
        "color": 4,
        "width": 680,
        "height": 1020,
        "content": "## \ud83d\uded2 Follow Up on Abandoned Carts with WhatsApp and Google Sheets\n\n## Who's it for\nD2C and e-commerce sellers who track cart activity in a Google Sheet (synced from their store or logged manually) and want abandoned carts followed up automatically, with a bigger incentive reserved for carts actually worth chasing.\n\n## How it works\nOn a schedule, the workflow checks your Carts sheet for abandoned carts that are old enough to follow up on, haven't already converted, and haven't hit your follow-up limit. High-value carts get a WhatsApp message with a discount code, low-value carts get a plain reminder instead, so you're not discounting your way into a loss on every small cart. Either way, the sheet is updated with a follow-up count and timestamp, so nobody gets messaged more than your configured limit.\n\n## How to set up\n1. Connect your Google Sheets credentials and point the workflow at your Carts sheet.\n2. Connect your WhatsApp Business Cloud credentials.\n3. Make sure your sheet has these columns: row_id, customer_name, phone_number, cart_value, items_summary, abandoned_at, purchased, follow_up_count, last_follow_up_at.\n4. Open the Set Configuration node and fill in your Sheet ID, WhatsApp phone number ID, high-value threshold, discount code, follow-up delay, and follow-up limit.\n5. Set your preferred check frequency in the Schedule Trigger.\n6. Activate the workflow.\n\n## Requirements\n- Google Sheets account\n- WhatsApp Business Cloud API access\n\n## How to customize\nAdjust the high-value threshold and discount code to match your margins. Change follow_up_delay_hours or max_follow_ups in Set Configuration to be more or less aggressive with follow-ups."
      },
      "typeVersion": 1
    },
    {
      "id": "919ecfee-fe95-423f-b610-5b0e31f3db31",
      "name": "Section - Trigger and Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 900,
        "height": 400,
        "content": "## 1\ufe0f\u20e3 2\ufe0f\u20e3 Trigger + Configuration\nRuns on a schedule (e.g. every hour). Pulls every cart from your sheet, filtering happens in the next step. Required columns: row_id, customer_name, phone_number, cart_value, items_summary, abandoned_at, purchased, follow_up_count, last_follow_up_at."
      },
      "typeVersion": 1
    },
    {
      "id": "5d9ed768-18c8-4fb3-b847-f3f0afe2053e",
      "name": "Section - Filter Eligible",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        208
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 388,
        "content": "## 3\ufe0f\u20e3 Filter Who's Actually Eligible\nOnly keeps carts that are old enough to follow up on, haven't already converted, and haven't hit the follow-up limit. This is what stops customers getting spammed."
      },
      "typeVersion": 1
    },
    {
      "id": "8c62a00e-6357-4f80-9924-f9810df6d44b",
      "name": "Section - Value Branch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 700,
        "height": 620,
        "content": "## 4\ufe0f\u20e3 Branch by Cart Value\nOnly high-value carts get a discount code, everything else gets a plain reminder, so you're not discounting your way into a loss on a small cart."
      },
      "typeVersion": 1
    },
    {
      "id": "2227ee8d-23ce-4797-8104-ad260b3fd9f8",
      "name": "Section - Update Sheet",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2352,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 424,
        "content": "## 5\ufe0f\u20e3 Log the Follow-Up\nBoth branches land here. Increments follow_up_count and records the timestamp, this is what the eligibility filter checks next time around."
      },
      "typeVersion": 1
    },
    {
      "id": "db834af2-3b57-4879-bc73-4a118aa7fc14",
      "name": "Set Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        576,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-1",
              "name": "sheet_id",
              "type": "string",
              "value": "REPLACE_WITH_GOOGLE_SHEET_ID"
            },
            {
              "id": "cfg-2",
              "name": "sheet_name",
              "type": "string",
              "value": "Carts"
            },
            {
              "id": "cfg-3",
              "name": "whatsapp_phone_number_id",
              "type": "string",
              "value": "REPLACE_WITH_WHATSAPP_PHONE_NUMBER_ID"
            },
            {
              "id": "cfg-4",
              "name": "high_value_threshold",
              "type": "number",
              "value": 2000
            },
            {
              "id": "cfg-5",
              "name": "discount_code",
              "type": "string",
              "value": "COMEBACK10"
            },
            {
              "id": "cfg-6",
              "name": "discount_percent",
              "type": "number",
              "value": 10
            },
            {
              "id": "cfg-7",
              "name": "follow_up_delay_hours",
              "type": "number",
              "value": 3
            },
            {
              "id": "cfg-8",
              "name": "max_follow_ups",
              "type": "number",
              "value": 2
            },
            {
              "id": "cfg-9",
              "name": "eligible_cutoff",
              "type": "string",
              "value": "={{ $now.minus({ hours: 3 }).toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6ed37c3e-9b27-4db8-ae6b-dd2a83297501",
      "name": "Fetch Abandoned Carts",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        928,
        416
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set Configuration').item.json.sheet_name }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Configuration').item.json.sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "f5cfed08-a7c2-4479-ac76-f40ac34ffe7f",
      "name": "Filter Eligible Carts",
      "type": "n8n-nodes-base.filter",
      "position": [
        1312,
        416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d3861b5f-83f4-4cc4-a2f1-f71116ec4ebf",
              "operator": {
                "type": "dateTime",
                "operation": "before"
              },
              "leftValue": "={{ $json.abandoned_at }}",
              "rightValue": "={{ $('Set Configuration').item.json.eligible_cutoff }}"
            },
            {
              "id": "e1b10723-0741-4731-b567-b498e0431b06",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.follow_up_count }}",
              "rightValue": "={{ $('Set Configuration').item.json.max_follow_ups }}"
            },
            {
              "id": "966cd9b0-6635-44c4-b1b8-23a6b227e939",
              "operator": {
                "type": "boolean",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.purchased }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c3d2c87f-f380-4e35-b782-61572c3e0000",
      "name": "Is High Value Cart?",
      "type": "n8n-nodes-base.if",
      "position": [
        1664,
        416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b831817f-d2e6-4ede-a075-750d8edcbd5f",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.cart_value }}",
              "rightValue": "={{ $('Set Configuration').item.json.high_value_threshold }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e21f49f0-9222-4288-8343-6a6bbd102640",
      "name": "Send Discount Offer",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2032,
        272
      ],
      "parameters": {
        "textBody": "=Hi {{ $json.customer_name }}, you left {{ $json.items_summary }} in your cart! Here's {{ $('Set Configuration').item.json.discount_percent }}% off if you complete it now: use code {{ $('Set Configuration').item.json.discount_code }} at checkout.",
        "operation": "send",
        "phoneNumberId": "={{ $('Set Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $json.phone_number }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "16b9ee57-505c-4c9a-b342-a5be70849802",
      "name": "Send Plain Reminder",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2032,
        560
      ],
      "parameters": {
        "textBody": "=Hi {{ $json.customer_name }}, just a reminder that {{ $json.items_summary }} is still waiting in your cart! Complete your order whenever you're ready.",
        "operation": "send",
        "phoneNumberId": "={{ $('Set Configuration').item.json.whatsapp_phone_number_id }}",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $json.phone_number }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f2dd9f44-f606-496f-843b-ed4d00cf3a25",
      "name": "Update Sheet - Mark Followed Up",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2448,
        400
      ],
      "parameters": {
        "columns": {
          "value": {
            "row_id": "={{ $('Filter Eligible Carts').item.json.row_id }}",
            "follow_up_count": "={{ $('Filter Eligible Carts').item.json.follow_up_count + 1 }}",
            "last_follow_up_at": "={{ $now.toISO() }}"
          },
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_id"
          ]
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set Configuration').item.json.sheet_name }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set Configuration').item.json.sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "d950177c-ef2e-40b2-b6ec-da5994e86de7",
      "name": "Every Hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        336,
        416
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "786b6f33-b521-46de-ae69-9331b6f18c72",
  "nodeGroups": [],
  "connections": {
    "Every Hour": {
      "main": [
        [
          {
            "node": "Set Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Configuration": {
      "main": [
        [
          {
            "node": "Fetch Abandoned Carts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is High Value Cart?": {
      "main": [
        [
          {
            "node": "Send Discount Offer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Plain Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Discount Offer": {
      "main": [
        [
          {
            "node": "Update Sheet - Mark Followed Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Plain Reminder": {
      "main": [
        [
          {
            "node": "Update Sheet - Mark Followed Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Abandoned Carts": {
      "main": [
        [
          {
            "node": "Filter Eligible Carts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Eligible Carts": {
      "main": [
        [
          {
            "node": "Is High Value Cart?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}