{
  "name": "Generate AI-powered contracts with OpenAI, e-signature, Gmail and Sheets",
  "nodes": [
    {
      "id": "ce89136e-5810-4f42-b2a6-6ce919081de1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -336
      ],
      "parameters": {
        "width": 340,
        "height": 420,
        "content": "## Contract Template Generator with E-Signature Integration\n\n### Overview\nAutomatically generates customized contract documents based on client requirements, uses AI to suggest optimal terms, and inte"
      }
    },
    {
      "id": "004d7bf0-f75b-4567-841e-dea81f165245",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        0
      ],
      "parameters": {
        "width": 280,
        "height": 524,
        "content": "### Step 1: Contract Request Intake\n- Receives contract request via webhook\n- Validates required fields (contract type, parties, terms)\n- Generates unique contract ID for tracking"
      }
    },
    {
      "id": "f518c643-e7fa-4498-accc-f145fb71dd1c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -112
      ],
      "parameters": {
        "width": 460,
        "height": 672,
        "content": "### Step 2: AI Contract Generation\n- Routes to appropriate template by contract type\n- AI Agent analyzes contract requirements\n- Suggests optimal terms and clauses\n- Generates Markdown-formatted contr"
      }
    },
    {
      "id": "6f4e6192-9d2e-4dd8-a7da-6ed742c47b4a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        -112
      ],
      "parameters": {
        "width": 420,
        "height": 684,
        "content": "### Step 3: Document Processing & Signature Request\n- Converts Markdown to HTML for professional formatting\n- Sends document to e-signature service\n- Uses Wait node to pause until signature webhook re"
      }
    },
    {
      "id": "53e93fbf-dd03-4c7d-b165-2f3b72eeeba1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1824,
        -112
      ],
      "parameters": {
        "width": 380,
        "height": 576,
        "content": "### Step 4: Completion & Notification\n- Processes signature confirmation from webhook\n- Logs completed contract details to Google Sheets\n- Sends confirmation emails to all parties\n- Handles expired/pe"
      }
    },
    {
      "id": "f23b334c-1139-45aa-9eff-0a8087cb2a10",
      "name": "Contract Request Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        48,
        208
      ]
    },
    {
      "id": "f0acca3d-f5df-475d-888d-14e80f373b49",
      "name": "Validate Contract Request",
      "type": "n8n-nodes-base.if",
      "position": [
        272,
        208
      ]
    },
    {
      "id": "1e3be390-afc2-4326-9b55-b5150ffb5465",
      "name": "Invalid Request Response",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        368
      ]
    },
    {
      "id": "c15f0e96-584b-4870-984c-154be193c2f8",
      "name": "Prepare Contract Data",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        208
      ]
    },
    {
      "id": "05e7de11-0253-44a8-98c3-b7803689fe2d",
      "name": "Route by Contract Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        704,
        208
      ]
    },
    {
      "id": "574932b8-79f0-4b8c-8f68-b109296f830a",
      "name": "NDA Template Base",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        48
      ]
    },
    {
      "id": "3cb67007-c983-4143-a0b4-ab7e757963f3",
      "name": "Service Agreement Base",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        208
      ]
    },
    {
      "id": "245cdb87-1937-4b4e-a0a0-503cab265af1",
      "name": "Employment Contract Base",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        368
      ]
    },
    {
      "id": "606d52b7-e2b5-4b42-9a8e-a626740315d3",
      "name": "Generic Contract Base",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        528
      ]
    },
    {
      "id": "0e6990f5-dfc1-4cb4-9aff-18d1a870e943",
      "name": "Merge Template Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        1152,
        208
      ]
    },
    {
      "id": "5c46e53d-62d2-4055-a180-dee791e47615",
      "name": "AI Contract Advisor",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        208
      ]
    },
    {
      "id": "373f6f64-dd98-45f9-a615-a3e1629d2b52",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1344,
        432
      ]
    },
    {
      "id": "f5dd9e83-0fdb-489a-baa4-d3439093dee9",
      "name": "Parse AI Contract Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        208
      ]
    },
    {
      "id": "57000b29-1b1a-49c4-a882-0c6b164ab551",
      "name": "Convert Markdown to HTML",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1792,
        208
      ]
    },
    {
      "id": "37d002c5-1b45-452f-aa77-cd56f5def4a2",
      "name": "Prepare Signature Request",
      "type": "n8n-nodes-base.code",
      "position": [
        2000,
        208
      ]
    },
    {
      "id": "5b9ee987-f85f-453e-81a8-97c770c48280",
      "name": "Send to E-Signature Service",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2224,
        208
      ]
    },
    {
      "id": "044abe06-c6ff-45f2-9f00-0b0d60f0e8f5",
      "name": "Send Signing Request Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2448,
        96
      ]
    },
    {
      "id": "410c3dfb-48a9-4884-a5a9-06b6360f169c",
      "name": "Wait for Signature Webhook",
      "type": "n8n-nodes-base.wait",
      "position": [
        2448,
        272
      ]
    },
    {
      "id": "295ca481-6ed5-436e-8171-f9e82269feaf",
      "name": "Process Signature Result",
      "type": "n8n-nodes-base.code",
      "position": [
        2672,
        272
      ]
    },
    {
      "id": "bad71063-390f-4160-891d-deecd502ec5d",
      "name": "Check Signature Status",
      "type": "n8n-nodes-base.if",
      "position": [
        2880,
        272
      ]
    },
    {
      "id": "b0e252a8-7b89-40e1-b463-e6e890f0efdf",
      "name": "Log Completed Contract",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3120,
        160
      ]
    },
    {
      "id": "5d9c0856-fa6f-47a6-89a8-19ee12a921a6",
      "name": "Send Completion Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3344,
        160
      ]
    },
    {
      "id": "38eb1af3-9dec-4584-b707-5b5695c6ca20",
      "name": "Log Expired or Pending",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3120,
        400
      ]
    },
    {
      "id": "a689643d-343d-4cad-911a-1546e1cfb645",
      "name": "Send Reminder or Expiry Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3344,
        400
      ]
    },
    {
      "id": "0f8723aa-a47c-4bea-8138-795b2943efcc",
      "name": "Merge Final Results",
      "type": "n8n-nodes-base.merge",
      "position": [
        3568,
        272
      ]
    },
    {
      "id": "93ccaf19-0657-4822-90d6-926f8c9a4940",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3792,
        272
      ]
    }
  ],
  "connections": {
    "NDA Template Base": {
      "main": [
        [
          {
            "node": "Merge Template Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Contract Advisor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Contract Advisor": {
      "main": [
        [
          {
            "node": "Parse AI Contract Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Final Results": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Template Data": {
      "main": [
        [
          {
            "node": "AI Contract Advisor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generic Contract Base": {
      "main": [
        [
          {
            "node": "Merge Template Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Contract Data": {
      "main": [
        [
          {
            "node": "Route by Contract Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Completion Email": {
      "main": [
        [
          {
            "node": "Merge Final Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Signature Status": {
      "main": [
        [
          {
            "node": "Log Completed Contract",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Expired or Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Completed Contract": {
      "main": [
        [
          {
            "node": "Send Completion Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Expired or Pending": {
      "main": [
        [
          {
            "node": "Send Reminder or Expiry Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Contract Type": {
      "main": [
        [
          {
            "node": "NDA Template Base",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Service Agreement Base",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Employment Contract Base",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generic Contract Base",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Service Agreement Base": {
      "main": [
        [
          {
            "node": "Merge Template Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contract Request Webhook": {
      "main": [
        [
          {
            "node": "Validate Contract Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Markdown to HTML": {
      "main": [
        [
          {
            "node": "Prepare Signature Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Employment Contract Base": {
      "main": [
        [
          {
            "node": "Merge Template Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invalid Request Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Signature Result": {
      "main": [
        [
          {
            "node": "Check Signature Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Signature Request": {
      "main": [
        [
          {
            "node": "Send to E-Signature Service",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Contract Request": {
      "main": [
        [
          {
            "node": "Prepare Contract Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Invalid Request Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Contract Response": {
      "main": [
        [
          {
            "node": "Convert Markdown to HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Signature Webhook": {
      "main": [
        [
          {
            "node": "Process Signature Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to E-Signature Service": {
      "main": [
        [
          {
            "node": "Send Signing Request Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait for Signature Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Reminder or Expiry Email": {
      "main": [
        [
          {
            "node": "Merge Final Results",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}