{
  "name": "WhatsApp follow-up sequence",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{ "field": "hours", "hoursInterval": 1 }]
        }
      },
      "id": "6d2a7c40-1b2e-4c11-8f0a-2c1b22f2b001",
      "name": "Every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [-260, 0]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://example.com/api/leads?status=awaiting_reply",
        "options": {}
      },
      "id": "6d2a7c40-1b2e-4c11-8f0a-2c1b22f2b002",
      "name": "Fetch leads awaiting reply",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-40, 0]
    },
    {
      "parameters": { "options": {} },
      "id": "6d2a7c40-1b2e-4c11-8f0a-2c1b22f2b003",
      "name": "One item per lead",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [180, 0]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "version": 2 },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1",
              "operator": { "type": "number", "operation": "gte" },
              "leftValue": "={{ $now.diff($json.created_at, 'hours').hours }}",
              "rightValue": 24
            },
            {
              "id": "c2",
              "operator": { "type": "number", "operation": "lt" },
              "leftValue": "={{ $json.followups_sent || 0 }}",
              "rightValue": 3
            }
          ]
        },
        "options": {}
      },
      "id": "6d2a7c40-1b2e-4c11-8f0a-2c1b22f2b004",
      "name": "Due a follow-up",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [400, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/v21.0/{{ $env.WHATSAPP_PHONE_NUMBER_ID }}/messages",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ messaging_product: 'whatsapp', to: $json.phone, type: 'template', template: { name: 'followup_check_in', language: { code: 'en' }, components: [{ type: 'body', parameters: [{ type: 'text', text: $json.first_name || 'there' }] }] } }) }}",
        "options": {}
      },
      "id": "6d2a7c40-1b2e-4c11-8f0a-2c1b22f2b005",
      "name": "Send WhatsApp template",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [640, -100]
    },
    {
      "parameters": {
        "method": "PATCH",
        "url": "=https://example.com/api/leads/{{ $json.id }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ followups_sent: ($json.followups_sent || 0) + 1, last_followup_at: $now.toISO() }) }}",
        "options": {}
      },
      "id": "6d2a7c40-1b2e-4c11-8f0a-2c1b22f2b006",
      "name": "Record the send",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [880, -100]
    }
  ],
  "connections": {
    "Every hour": {
      "main": [[{ "node": "Fetch leads awaiting reply", "type": "main", "index": 0 }]]
    },
    "Fetch leads awaiting reply": {
      "main": [[{ "node": "One item per lead", "type": "main", "index": 0 }]]
    },
    "One item per lead": { "main": [[{ "node": "Due a follow-up", "type": "main", "index": 0 }]] },
    "Due a follow-up": {
      "main": [[{ "node": "Send WhatsApp template", "type": "main", "index": 0 }], []]
    },
    "Send WhatsApp template": {
      "main": [[{ "node": "Record the send", "type": "main", "index": 0 }]]
    }
  },
  "settings": { "executionOrder": "v1" },
  "active": false,
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "source": "godesigntech.com free n8n template library"
  }
}
