{
  "name": "Automate medical rep visit workflow with Google Sheets, Gmail & OpenAI summaries",
  "nodes": [
    {
      "id": "eb7a600c-01d4-46bc-9963-065e690f8437",
      "name": "Fetch MR Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        224,
        304
      ]
    },
    {
      "id": "e4966a5f-518d-46c5-a96d-85db4aa1e0f3",
      "name": "Send Plan Email to MR",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        304
      ]
    },
    {
      "id": "b1a148ef-ac76-40f6-b1d0-2e8111004d07",
      "name": "Fetch Pending Records",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        144,
        688
      ]
    },
    {
      "id": "4fb11931-4d3b-4e57-8344-a79db509a211",
      "name": "Send Reminder Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        368,
        688
      ]
    },
    {
      "id": "e88a4910-1596-4553-b5b4-52940d14973e",
      "name": "Fetch Form Responses",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        80,
        1088
      ]
    },
    {
      "id": "ef0aa4f9-5b08-47ec-a04d-1a5669d1b5e2",
      "name": "Send Summary to Manager",
      "type": "n8n-nodes-base.gmail",
      "position": [
        656,
        1088
      ]
    },
    {
      "id": "48461e38-d7ed-453c-9ea4-bd95394b5bf4",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        304,
        1088
      ]
    },
    {
      "id": "02e6f15b-f88a-46ca-a014-fd58877d8116",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        384,
        1312
      ]
    },
    {
      "id": "d43feee7-beaf-43e3-9bb1-899ef7fc0280",
      "name": "Update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        304
      ]
    },
    {
      "id": "24db74c3-ef2d-4115-b9da-07cc4b0b9125",
      "name": "Schedule To Assign Work",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        304
      ]
    },
    {
      "id": "90e39a29-8b34-4b92-92ab-a93099449b6a",
      "name": "Schedule For Remind Pending work",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -80,
        688
      ]
    },
    {
      "id": "dbb1366f-09ef-40b5-ab22-44113e668e28",
      "name": "Schedule for Summary Update",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -144,
        1088
      ]
    },
    {
      "id": "07f6d282-a7c6-430a-8941-6c726fdb5b68",
      "name": "Update row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        688
      ]
    },
    {
      "id": "cda49ce5-48e6-43ba-b2a2-acf124239c1e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        368
      ],
      "parameters": {
        "width": 464,
        "height": 592,
        "content": "## How it works\nThis workflow helps teams automate the daily routine of assigning doctor visits to Medical Representatives (MRs), collecting their updates, and sending a clean end-of-day summary to ma"
      }
    },
    {
      "id": "6a3f3e1b-2623-43c2-b989-47e732b1d7e9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        128
      ],
      "parameters": {
        "width": 1296,
        "height": 320,
        "content": "## Daily Work Assignment\n**Every morning, a scheduled trigger starts the workflow at the defined time. It first reads the MR work allocation sheet and collects all rows where the visit plan is still m"
      }
    },
    {
      "id": "7384b445-f7b9-4203-a8f9-d047fd1e7ded",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        512
      ],
      "parameters": {
        "width": 1312,
        "height": 336,
        "content": "## Reminder Flow\n**Each evening, a scheduled trigger starts the reminder workflow at the set time. It reads the work allocation sheet and identifies all records where the visit is still marked as “Pen"
      }
    },
    {
      "id": "ec2df301-3ae2-4a2b-8761-2a992afc49e0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        944
      ],
      "parameters": {
        "width": 1312,
        "height": 496,
        "content": "## Reporting and Summary\n**At the end of the day, a scheduled trigger starts the summary workflow at the designated time. It retrieves all Google Form responses submitted by the MRs throughout the day"
      }
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send Summary to Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch MR Sheet": {
      "main": [
        [
          {
            "node": "Send Plan Email to MR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Reminder Email": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Form Responses": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Pending Records": {
      "main": [
        [
          {
            "node": "Send Reminder Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Plan Email to MR": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule To Assign Work": {
      "main": [
        [
          {
            "node": "Fetch MR Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule for Summary Update": {
      "main": [
        [
          {
            "node": "Fetch Form Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule For Remind Pending work": {
      "main": [
        [
          {
            "node": "Fetch Pending Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}