{
  "name": "LeadFlow AI \u2014 03 Follow-up Scheduler",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 1
            }
          ]
        }
      },
      "id": "575f06f5-a742-4568-9116-0dd9162c001f",
      "name": "Every Hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "http://leadflow-api:8000/api/followups/due?limit=100",
        "options": {
          "timeout": 30000
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-LeadFlow-Key",
              "value": "={{ $env.LEADFLOW_INTERNAL_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "id": "ec4b1975-ca8f-48f6-bd18-ac97eacc53fa",
      "name": "Get Due Follow-ups",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        260,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const items = $json.items ?? [];\nreturn items.map((item) => ({ json: item }));"
      },
      "id": "11c0edf1-3a6c-440e-bef9-f727bc6a85bd",
      "name": "Split Follow-ups",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=http://leadflow-api:8000/api/followups/{{$json.id}}/send",
        "options": {
          "timeout": 60000
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-LeadFlow-Key",
              "value": "={{ $env.LEADFLOW_INTERNAL_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ {} }}"
      },
      "id": "b54e9b2f-e66d-4cb6-8c57-91f0abed5d97",
      "name": "Send Follow-up",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        780,
        0
      ]
    }
  ],
  "connections": {
    "Every Hour": {
      "main": [
        [
          {
            "node": "Get Due Follow-ups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Due Follow-ups": {
      "main": [
        [
          {
            "node": "Split Follow-ups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Follow-ups": {
      "main": [
        [
          {
            "node": "Send Follow-up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "818b8dc2-2cb2-4380-8bb7-889fe748f51f",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": [],
  "id": "55902a84-1bca-4f90-a395-496319f6bbab"
}