{
  "name": "Send AI pre-op reminders with Google Calendar, Gmail, Sheets, Slack and GPT-4o",
  "nodes": [
    {
      "id": "9cb44951-2696-41c7-9b9f-ba9f88eec30d",
      "name": "Schedule Trigger: Daily 9:00 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1616,
        80
      ]
    },
    {
      "id": "5e89bd0d-fcda-4e4f-b041-e3d9e4c32b68",
      "name": "Google Calendar: Fetch Today’s Events",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        -1376,
        80
      ]
    },
    {
      "id": "6dbbade9-5c8a-4d68-99a7-85e575b54d65",
      "name": "Extract Surgery Events + Patient Fields",
      "type": "n8n-nodes-base.code",
      "position": [
        -1136,
        80
      ]
    },
    {
      "id": "7155eea4-a86f-42ee-a4b9-0826745db1ae",
      "name": "Build Unique Confirmation Link (confirmUrl)",
      "type": "n8n-nodes-base.code",
      "position": [
        -912,
        80
      ]
    },
    {
      "id": "0d98c297-dd1b-4713-93a6-43df54ceaa04",
      "name": "Clean Patient Fields (Name/Email/Phone/ID)",
      "type": "n8n-nodes-base.code",
      "position": [
        -704,
        80
      ]
    },
    {
      "id": "3fd06e20-f901-4a98-a3d6-16401a7fb7df",
      "name": "AI: Generate Pre-Op Checklist Email (Subject + HTML Body)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -480,
        80
      ]
    },
    {
      "id": "5bc9ecda-dd47-4165-8500-35ea83960ba9",
      "name": "LLM: Azure OpenAI Chat Model (gpt-4o)",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -496,
        320
      ]
    },
    {
      "id": "e8df273d-ea03-4adb-bbbf-9484676512a7",
      "name": "Parse AI Output (Subject/Body JSON)",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -288,
        304
      ]
    },
    {
      "id": "320ba35d-f4f4-4cf3-8e2b-68b60683e784",
      "name": "Gmail: Send Pre-Op Checklist Reminder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -64,
        80
      ]
    },
    {
      "id": "0eb7713d-6b31-4a1f-9c84-4188eacdd2e4",
      "name": "Webhook: Patient Checklist Confirmation (GET /confirm)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1648,
        688
      ]
    },
    {
      "id": "54a170ab-b038-40d0-9203-0ef8d2f49fbc",
      "name": "Parse Query Params + Mark Confirmed (patient_id, uniqueId, confirmedAt)",
      "type": "n8n-nodes-base.code",
      "position": [
        -1360,
        688
      ]
    },
    {
      "id": "1c286f09-82f3-49dd-bd9d-aa0c063218a0",
      "name": "Google Sheets: Upsert Patient Confirmation Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1088,
        688
      ]
    },
    {
      "id": "87000ced-b5f8-4f9f-8b4a-007d72866349",
      "name": "Schedule Trigger: Periodic Confirmation Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1680,
        1184
      ]
    },
    {
      "id": "83830ae1-7ac5-47df-a4ef-70873e30e67b",
      "name": "Google Sheets: Fetch Patient Confirmation Rows",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1424,
        1184
      ]
    },
    {
      "id": "e5f71b2f-e692-4b2f-a16a-c9a78f278e8c",
      "name": "IF: Confirmed = true (route unmatched = not confirmed)",
      "type": "n8n-nodes-base.if",
      "position": [
        -1216,
        1184
      ]
    },
    {
      "id": "c1bbfc25-3cc5-45a9-9f96-fb98f8426c01",
      "name": "Slack: Alert Nurse/Owner — Checklist Not Confirmed",
      "type": "n8n-nodes-base.slack",
      "position": [
        -864,
        1200
      ]
    },
    {
      "id": "c88fad6a-9a0a-45ec-9112-63cee20797dd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2976,
        -368
      ],
      "parameters": {
        "width": 688,
        "height": 720,
        "content": "## 🏥 AI-Powered Patient Pre-Op Reminder & Nurse Alert System\n### What this workflow does\nThis workflow automates pre-surgery checklist reminders for patients and tracks their confirmation status end-t"
      }
    },
    {
      "id": "e0950490-833d-4c58-a9ab-13bd9e78685b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1824,
        -128
      ],
      "parameters": {
        "width": 608,
        "height": 432,
        "content": "## 📅 Daily Surgery Intake & Patient Extraction\n\nFetches today’s calendar events and filters\nonly surgery-related entries.\n\n• Pulls events from Google Calendar  \n• Extracts patient details from descrip"
      }
    },
    {
      "id": "39940b45-36e7-41c0-90d4-5d3addf4dd05",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -112
      ],
      "parameters": {
        "width": 624,
        "height": 416,
        "content": "## 🔗 Build Unique Patient Confirmation Links\n\nCreates a unique, trackable confirmation\nURL per patient.\n\n• Generates secure confirmUrl  \n• Adds timestamps + IDs  \n• Enables click tracking per patient "
      }
    },
    {
      "id": "7ac09893-52fe-4da7-bd98-752cc8de8166",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -112
      ],
      "parameters": {
        "width": 384,
        "height": 640,
        "content": "## ✉️ AI Pre-Op Checklist Email Generation\n\nCreates a patient-friendly checklist email\nusing real surgery details.\n\n• Personalized subject + HTML body  \n• Includes confirmation button  \n• Safe, non-cl"
      }
    },
    {
      "id": "b40c06b8-116e-4af7-930e-3add83ed9be3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -192
      ],
      "parameters": {
        "width": 320,
        "height": 496,
        "content": "## 📤 Send Checklist Reminder (Gmail)\n\nSends the pre-op checklist email\nto the patient.\n\n• Uses Gmail for delivery  \n• Supports styled HTML emails  \n• Human-readable patient message  \n"
      }
    },
    {
      "id": "b3e4a1c6-9ba4-42f2-b2da-39c4de528cd8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1696,
        448
      ],
      "parameters": {
        "width": 496,
        "height": 432,
        "content": "## ✅ Patient Confirmation Capture (Webhook)\n\nReceives confirmation when the patient\nclicks the email button.\n\n• Parses patient_id + uniqueId  \n• Marks checklist as confirmed  \n• Feeds data into tracki"
      }
    },
    {
      "id": "11e3b3c5-7c6a-4270-b081-fef373480815",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        384
      ],
      "parameters": {
        "width": 368,
        "height": 496,
        "content": "## 🧾 Store Confirmation Status (Google Sheets)\n\nStores and updates patient confirmation\nrecords for audit and ops visibility.\n\n• Upserts confirmation status  \n• Tracks confirmed_at timestamp  \n• Acts "
      }
    },
    {
      "id": "69246534-8cf5-4299-bc68-0be5d0d850a0",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1728,
        976
      ],
      "parameters": {
        "width": 704,
        "height": 400,
        "content": "## ⏳ Periodic Confirmation Check\n\nPeriodically scans patients who have\nnot confirmed on time.\n\n• Reads patient rows from Sheets  \n• Filters confirmed vs not confirmed  \n• Flags risky cases for follow-"
      }
    },
    {
      "id": "096c15ab-89f7-470d-8ba1-60bde7af780f",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        976
      ],
      "parameters": {
        "width": 320,
        "height": 400,
        "content": "## 🚨 Alert Care Team for Missing Confirmations\n\nNotifies nurse or owner when a patient\nhas not confirmed the checklist.\n\n• Sends full patient context to Slack  \n• Highlights surgery time + procedure  "
      }
    },
    {
      "id": "f9e8d987-0e48-45c7-aeb8-158449c0dc5d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        1072
      ],
      "parameters": {
        "width": 352,
        "height": 304,
        "content": "## 🔐 Credentials & Safety Notes\n\n• Google Calendar OAuth  \n• Gmail OAuth2  \n• Azure OpenAI API  \n• Google Sheets OAuth  \n• Slack API  \n\nDo not include medical advice beyond basic reminders.\nAlways kee"
      }
    }
  ],
  "connections": {
    "Schedule Trigger: Daily 9:00 AM": {
      "main": [
        [
          {
            "node": "Google Calendar: Fetch Today’s Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output (Subject/Body JSON)": {
      "ai_outputParser": [
        [
          {
            "node": "AI: Generate Pre-Op Checklist Email (Subject + HTML Body)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Gmail: Send Pre-Op Checklist Reminder": {
      "main": [
        []
      ]
    },
    "LLM: Azure OpenAI Chat Model (gpt-4o)": {
      "ai_languageModel": [
        [
          {
            "node": "AI: Generate Pre-Op Checklist Email (Subject + HTML Body)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract Surgery Events + Patient Fields": {
      "main": [
        [
          {
            "node": "Build Unique Confirmation Link (confirmUrl)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar: Fetch Today’s Events": {
      "main": [
        [
          {
            "node": "Extract Surgery Events + Patient Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Patient Fields (Name/Email/Phone/ID)": {
      "main": [
        [
          {
            "node": "AI: Generate Pre-Op Checklist Email (Subject + HTML Body)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Unique Confirmation Link (confirmUrl)": {
      "main": [
        [
          {
            "node": "Clean Patient Fields (Name/Email/Phone/ID)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger: Periodic Confirmation Check": {
      "main": [
        [
          {
            "node": "Google Sheets: Fetch Patient Confirmation Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Fetch Patient Confirmation Rows": {
      "main": [
        [
          {
            "node": "IF: Confirmed = true (route unmatched = not confirmed)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Upsert Patient Confirmation Status": {
      "main": [
        []
      ]
    },
    "IF: Confirmed = true (route unmatched = not confirmed)": {
      "main": [
        [],
        [
          {
            "node": "Slack: Alert Nurse/Owner — Checklist Not Confirmed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook: Patient Checklist Confirmation (GET /confirm)": {
      "main": [
        [
          {
            "node": "Parse Query Params + Mark Confirmed (patient_id, uniqueId, confirmedAt)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: Generate Pre-Op Checklist Email (Subject + HTML Body)": {
      "main": [
        [
          {
            "node": "Gmail: Send Pre-Op Checklist Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Query Params + Mark Confirmed (patient_id, uniqueId, confirmedAt)": {
      "main": [
        [
          {
            "node": "Google Sheets: Upsert Patient Confirmation Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}