{
  "name": "Analyze contract risk from Google Drive with OpenAI and log to Gmail & Sheets",
  "nodes": [
    {
      "id": "94721676-0968-4cbf-8177-75e245c96fcd",
      "name": "Download file1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        6608,
        4736
      ]
    },
    {
      "id": "a518d2ee-a14b-4696-9d66-0c9f63bad53a",
      "name": "Extract Text From Downloaded File1",
      "type": "n8n-nodes-base.code",
      "position": [
        6784,
        4736
      ]
    },
    {
      "id": "c6f6459d-6438-45db-9e61-b7b11dc5f5b6",
      "name": "AI Contract Analysis1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        6960,
        4736
      ]
    },
    {
      "id": "144bba7f-04e4-41ee-b901-07b90b8f4c41",
      "name": "Format AI Output1",
      "type": "n8n-nodes-base.code",
      "position": [
        7264,
        4736
      ]
    },
    {
      "id": "2b3a4dbe-5e5e-4c6b-8e57-67fcaa8e3652",
      "name": "Alert Teams Automatically1",
      "type": "n8n-nodes-base.if",
      "position": [
        7456,
        4736
      ]
    },
    {
      "id": "27ac6f18-01b7-4bdb-986d-8f35566e055a",
      "name": "Send a message2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        7664,
        4640
      ]
    },
    {
      "id": "36c8c170-5ed0-423f-a3ce-d1c7a2f8374e",
      "name": "Get The Data To Save In google Sheet2",
      "type": "n8n-nodes-base.code",
      "position": [
        7872,
        4640
      ]
    },
    {
      "id": "161ea93f-db54-4723-af64-110088549671",
      "name": "Send a message3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        7664,
        4832
      ]
    },
    {
      "id": "ca506624-1189-41eb-8cb7-5d88932a4827",
      "name": "Get The Data To Save In google Sheet3",
      "type": "n8n-nodes-base.code",
      "position": [
        7872,
        4832
      ]
    },
    {
      "id": "f0c7f8f7-e5e4-4b49-baa3-885c2453a0bd",
      "name": "Google Drive Trigger1",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        6448,
        4736
      ]
    },
    {
      "id": "89317dde-a623-4865-b85b-434d877ed5d6",
      "name": "Append row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        8112,
        4736
      ]
    },
    {
      "id": "a25edacc-6ddf-4eed-b994-5101857eb0fc",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5712,
        4352
      ],
      "parameters": {
        "width": 720,
        "height": 784,
        "content": "## AI Contract Summary Bot \nThis workflow automates end-to-end contract analysis using AI. When a new contract is uploaded to a monitored Google Drive folder, the system automatically downloads the fi"
      }
    },
    {
      "id": "880ec4bf-92c8-4bef-953a-8dea4e88f1dc",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6448,
        4352
      ],
      "parameters": {
        "width": 960,
        "height": 784,
        "content": "## Step 1: Contract Ingestion & AI Analysis\nTriggers on new contract upload, downloads the file, extracts text, and sends it to AI for detailed legal and commercial analysis.\n"
      }
    },
    {
      "id": "99fe4c8a-6f99-40ae-82b1-7b9a1608a8e6",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7424,
        4352
      ],
      "parameters": {
        "width": 896,
        "height": 784,
        "content": "## Step 2: Risk Alerts & Audit Logging\nEvaluates contract risk, sends alert or info emails, and logs structured results with timestamps into Google Sheets.\n"
      }
    }
  ],
  "connections": {
    "Download file1": {
      "main": [
        [
          {
            "node": "Extract Text From Downloaded File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message2": {
      "main": [
        [
          {
            "node": "Get The Data To Save In google Sheet2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message3": {
      "main": [
        [
          {
            "node": "Get The Data To Save In google Sheet3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format AI Output1": {
      "main": [
        [
          {
            "node": "Alert Teams Automatically1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Contract Analysis1": {
      "main": [
        [
          {
            "node": "Format AI Output1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger1": {
      "main": [
        [
          {
            "node": "Download file1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Teams Automatically1": {
      "main": [
        [
          {
            "node": "Send a message2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a message3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text From Downloaded File1": {
      "main": [
        [
          {
            "node": "AI Contract Analysis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get The Data To Save In google Sheet2": {
      "main": [
        [
          {
            "node": "Append row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get The Data To Save In google Sheet3": {
      "main": [
        [
          {
            "node": "Append row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}