{
  "name": "Triage and schedule healthcare appointments with Azure OpenAI, Google Sheets and Gmail",
  "nodes": [
    {
      "id": "1bba7f53-0f2d-4524-b568-4c50ff57a7f1",
      "name": "📋 Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        1424
      ],
      "parameters": {
        "width": 500,
        "height": 940,
        "content": "## 🏥 Healthcare Appointment Booking Agent\n\n### How it works\nThis workflow automates the end-to-end healthcare appointment lifecycle across three parallel pipelines:\n\n**Pipeline 1 – Patient Intake & Tr"
      }
    },
    {
      "id": "ac280c74-63ef-48d7-a875-a195e7e86d58",
      "name": "Section: Patient Intake & Triage",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        1040
      ],
      "parameters": {
        "width": 760,
        "height": 260,
        "content": "## 📥 Patient Intake & Triage\nReceives raw patient lead via webhook, normalizes fields, and runs AI triage to determine urgency level, recommended department, and appointment priority. Results are save"
      }
    },
    {
      "id": "5defe252-87c6-47c1-ad25-719918a0e3dc",
      "name": "Section: Doctor Assignment & Notification",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        1568
      ],
      "parameters": {
        "width": 860,
        "height": 560,
        "content": "## 🩺 Doctor Assignment\nTriggered when a new patient row lands in Google Sheets. An AI Agent consults the doctor list and assigns the best-matched specialist. The appointment is written back to the she"
      }
    },
    {
      "id": "8ee3e637-1a7f-496a-931b-8031836c77ad",
      "name": "Section: Post-Visit Feedback",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        2336
      ],
      "parameters": {
        "width": 620,
        "height": 200,
        "content": "## 📬 Post-Visit Feedback\nRuns hourly via Schedule Trigger. Fetches appointments with a completed visit flag and sends each patient a personalized feedback form email."
      }
    },
    {
      "id": "0632ebb3-6f43-4c29-b7c2-414e5694321a",
      "name": "⚠️ Warning: Azure OpenAI Credentials",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        1568
      ],
      "parameters": {
        "width": 280,
        "height": 176,
        "content": "⚠️ **Azure OpenAI Credentials Required**\nBoth AI Agent nodes depend on this model. Ensure your Azure OpenAI API key, endpoint, and deployment name are correctly configured. Misconfiguration will silen"
      }
    },
    {
      "id": "a2fbc4ad-9ebc-40f8-ab53-8557e165581f",
      "name": "⚠️ Warning: Sheet Overwrite Risk",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        2080
      ],
      "parameters": {
        "width": 280,
        "height": 144,
        "content": "⚠️ **Google Sheets Write Risk**\nThis node appends or overwrites rows in the Scheduled Appointments sheet. Ensure column headers in the sheet exactly match the mapped fields to avoid data loss or misal"
      }
    },
    {
      "id": "de14fad4-bd31-44c1-a639-600f5faf6cfb",
      "name": "🔔 Patient Lead Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        1312
      ]
    },
    {
      "id": "38b38cfc-c8a4-4ebb-b217-1058a116eb90",
      "name": "🗂️ Format Patient Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        1312
      ]
    },
    {
      "id": "9edcdc48-1d7c-4a41-b59f-da560b2d806c",
      "name": "🤖 AI Triage Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -32,
        1200
      ]
    },
    {
      "id": "724790a3-9506-40c2-9724-d10295e742ef",
      "name": "🧠 Azure OpenAI – Triage Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        400,
        1600
      ]
    },
    {
      "id": "e30b1134-b3ed-40e1-b214-b784625f76ed",
      "name": "⚙️ Normalize Triage Output",
      "type": "n8n-nodes-base.code",
      "position": [
        320,
        1312
      ]
    },
    {
      "id": "1ae0015a-5eb5-4b7a-a0f9-0fe62fdd4138",
      "name": "📝 Save Triage to Patient Forms Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        1312
      ]
    },
    {
      "id": "e789fa52-cba1-4957-9f0c-900e518934a2",
      "name": "📊 New Patient Row Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -432,
        1832
      ]
    },
    {
      "id": "84c3a139-d345-4376-b824-5394d648603e",
      "name": "🤖 AI Doctor Assignment Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -208,
        1728
      ]
    },
    {
      "id": "99406cde-5ede-4567-b8c7-ef41b8da747d",
      "name": "🧠 Azure OpenAI – Assignment Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -200,
        1952
      ]
    },
    {
      "id": "ab7c8c9a-14f8-4276-8d70-ed48759ae002",
      "name": "📋 Fetch Doctor List from Sheet",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -72,
        1952
      ]
    },
    {
      "id": "437529df-3dbf-47f9-b1f1-89683952c744",
      "name": "⚙️ Normalize Assignment Output",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        1832
      ]
    },
    {
      "id": "917f4ee8-1b44-427d-b1f6-1a8d17ee6123",
      "name": "📝 Save Assignment to Appointments Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        368,
        1832
      ]
    },
    {
      "id": "37b9522c-7e6d-4d81-9499-175bba974b89",
      "name": "📋 Fetch Appointments for Doctor Email",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        1832
      ]
    },
    {
      "id": "59e63ad0-287e-41a7-a2d7-c882407b6478",
      "name": "⚙️ Build Doctor Schedule Email HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        1832
      ]
    },
    {
      "id": "e32eaa6d-7abf-4421-80b2-d2c268ee83d5",
      "name": "📧 Send Schedule Email to Doctor",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1040,
        1832
      ]
    },
    {
      "id": "76c06afc-5d1d-4fad-a69a-9943dee7d3d4",
      "name": "⏰ Hourly Feedback Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -432,
        2160
      ]
    },
    {
      "id": "f8994eed-f199-48de-bdcc-9d34ea2262a8",
      "name": "📋 Fetch All Appointments for Feedback",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -208,
        2160
      ]
    },
    {
      "id": "3c649240-625b-4d33-b192-fcb7a7d09e23",
      "name": "🔀 Filter Completed Visits",
      "type": "n8n-nodes-base.if",
      "position": [
        16,
        2160
      ]
    },
    {
      "id": "26e36e5e-d509-464f-a762-3bcfe818a620",
      "name": "📧 Send Feedback Email to Patient",
      "type": "n8n-nodes-base.gmail",
      "position": [
        240,
        2160
      ]
    }
  ],
  "connections": {
    "🤖 AI Triage Agent": {
      "main": [
        [
          {
            "node": "⚙️ Normalize Triage Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔔 Patient Lead Webhook": {
      "main": [
        [
          {
            "node": "🗂️ Format Patient Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🗂️ Format Patient Data": {
      "main": [
        [
          {
            "node": "🤖 AI Triage Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📊 New Patient Row Trigger": {
      "main": [
        [
          {
            "node": "🤖 AI Doctor Assignment Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 Filter Completed Visits": {
      "main": [
        [
          {
            "node": "📧 Send Feedback Email to Patient",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Normalize Triage Output": {
      "main": [
        [
          {
            "node": "📝 Save Triage to Patient Forms Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 AI Doctor Assignment Agent": {
      "main": [
        [
          {
            "node": "⚙️ Normalize Assignment Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📋 Fetch Doctor List from Sheet": {
      "ai_tool": [
        [
          {
            "node": "🤖 AI Doctor Assignment Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Normalize Assignment Output": {
      "main": [
        [
          {
            "node": "📝 Save Assignment to Appointments Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧠 Azure OpenAI – Triage Model": {
      "ai_languageModel": [
        [
          {
            "node": "🤖 AI Triage Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "⏰ Hourly Feedback Schedule Trigger": {
      "main": [
        [
          {
            "node": "📋 Fetch All Appointments for Feedback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧠 Azure OpenAI – Assignment Model": {
      "ai_languageModel": [
        [
          {
            "node": "🤖 AI Doctor Assignment Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Build Doctor Schedule Email HTML": {
      "main": [
        [
          {
            "node": "📧 Send Schedule Email to Doctor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📋 Fetch All Appointments for Feedback": {
      "main": [
        [
          {
            "node": "🔀 Filter Completed Visits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📋 Fetch Appointments for Doctor Email": {
      "main": [
        [
          {
            "node": "⚙️ Build Doctor Schedule Email HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📝 Save Assignment to Appointments Sheet": {
      "main": [
        [
          {
            "node": "📋 Fetch Appointments for Doctor Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}