{
  "id": "BDw84qlUvgbIP0Da",
  "name": "GPT 4.1-mini Automated Proposal to Payment Lifecycle Management",
  "tags": [],
  "nodes": [
    {
      "id": "31da2ed4-9ad3-410a-b061-1489beedb962",
      "name": "Proposal Request Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1920,
        252
      ],
      "parameters": {
        "options": {
          "appendAttribution": false
        },
        "formTitle": "Proposal Request Form",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Client Name"
            },
            {
              "fieldType": "email",
              "fieldLabel": "Client Email"
            },
            {
              "fieldLabel": "Project Title"
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Project Description"
            },
            {
              "fieldType": "number",
              "fieldLabel": "Budget"
            },
            {
              "fieldLabel": "Timeline"
            }
          ]
        },
        "formDescription": "Submit your project details to generate a proposal"
      },
      "typeVersion": 2.3
    },
    {
      "id": "acce37d0-fee1-4068-ab03-c3f949b04119",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1696,
        252
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "approverEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Approver email address__>"
            },
            {
              "id": "id-2",
              "name": "crmApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__CRM API endpoint URL__>"
            },
            {
              "id": "id-3",
              "name": "taskManagementApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Task management API endpoint URL__>"
            },
            {
              "id": "id-4",
              "name": "paymentDueDays",
              "type": "number",
              "value": 30
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "52ac7e76-314b-4ac6-9ff6-6027f1ea461a",
      "name": "Store Proposal Request",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1472,
        256
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "proposal_requests"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d2c7c89b-66a6-40bb-9e41-4579f1efbe2c",
      "name": "Generate Proposal",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1248,
        252
      ],
      "parameters": {
        "text": "=Client: {{ $json.clientName }}\nProject: {{ $json.projectTitle }}\nDescription: {{ $json.projectDescription }}\nBudget: ${{ $json.budget }}\nTimeline: {{ $json.timeline }}",
        "options": {
          "systemMessage": "You are a professional proposal writer. Generate a comprehensive business proposal based on the provided client and project information.\n\nYour proposal should include:\n1. Executive Summary\n2. Project Scope and Objectives\n3. Methodology and Approach\n4. Timeline and Milestones\n5. Budget Breakdown\n6. Terms and Conditions\n7. Next Steps\n\nMake the proposal professional, persuasive, and tailored to the client needs. Use clear language and structure."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "cf3d6b09-7333-44f1-ac16-5c0c94e98935",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1240,
        476
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "2a5e54cc-0988-423e-8eec-ba8ea3bec7c5",
      "name": "Proposal Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1072,
        480
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"proposalTitle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Title of the proposal\"\n\t\t},\n\t\t\"executiveSummary\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Executive summary section\"\n\t\t},\n\t\t\"projectScope\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Project scope and objectives\"\n\t\t},\n\t\t\"methodology\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Methodology and approach\"\n\t\t},\n\t\t\"timeline\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Timeline and milestones\"\n\t\t},\n\t\t\"budgetBreakdown\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Detailed budget breakdown\"\n\t\t},\n\t\t\"terms\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Terms and conditions\"\n\t\t},\n\t\t\"nextSteps\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Next steps\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "874521d3-7ac6-4658-8623-6d758b323f87",
      "name": "Store Generated Proposal",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -896,
        252
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "proposals"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f3b8641-e287-425c-a77b-500e90ceeec3",
      "name": "Send Proposal for Approval",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -672,
        252
      ],
      "parameters": {
        "sendTo": "={{ $('Workflow Configuration').first().json.approverEmail }}",
        "message": "=<h2>Proposal Approval Request</h2><p>A new proposal has been generated and requires your approval.</p><h3>{{ $json.proposalTitle }}</h3><p><strong>Client:</strong> {{ $('Store Proposal Request').first().json.clientName }}</p><p><strong>Project:</strong> {{ $('Store Proposal Request').first().json.projectTitle }}</p><p><strong>Budget:</strong> ${{ $('Store Proposal Request').first().json.budget }}</p><hr><h3>Executive Summary</h3><p>{{ $json.executiveSummary }}</p><p>Please review the full proposal and respond with your decision.</p>",
        "options": {},
        "subject": "=Proposal Approval Required: {{ $json.proposalTitle }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6e8f0e7c-3b35-44c1-9663-64edc6a127ff",
      "name": "Wait for Approval",
      "type": "n8n-nodes-base.wait",
      "position": [
        -448,
        252
      ],
      "parameters": {
        "resume": "webhook",
        "options": {},
        "resumeUnit": "days",
        "responseMode": "lastNode",
        "resumeAmount": 7,
        "limitWaitTime": true
      },
      "typeVersion": 1.1
    },
    {
      "id": "17a92420-c380-43a7-bb54-fe23f2834a3e",
      "name": "Check Approval Status",
      "type": "n8n-nodes-base.if",
      "position": [
        -224,
        252
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $('Wait for Approval').item.json.approved }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0916366b-4908-4273-9c01-51b624539c05",
      "name": "Generate Contract",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        48,
        240
      ],
      "parameters": {
        "text": "=Proposal: {{ $('Generate Proposal').first().json.proposalTitle }}\nClient: {{ $('Store Proposal Request').first().json.clientName }}\nBudget: ${{ $('Store Proposal Request').first().json.budget }}\nTimeline: {{ $('Store Proposal Request').first().json.timeline }}",
        "options": {
          "systemMessage": "You are a legal contract specialist. Convert the approved proposal into a formal contract document.\n\nYour contract should include:\n1. Contract Title and Parties\n2. Scope of Work (based on proposal)\n3. Payment Terms\n4. Timeline and Deliverables\n5. Intellectual Property Rights\n6. Confidentiality Clause\n7. Termination Conditions\n8. Liability and Warranties\n9. Dispute Resolution\n10. Signatures Section\n\nUse formal legal language while remaining clear and enforceable."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "5ebd594a-2fea-426d-82fa-0fd382ea3c1b",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        16,
        384
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6749ffb7-65fb-45f4-9413-b4bcf2bf8062",
      "name": "Contract Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        176,
        432
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"contractTitle\": \"Professional Services Agreement\",\n\t\"parties\": \"This agreement is between [Client Name] and [Service Provider]\",\n\t\"scopeOfWork\": \"Description of services to be provided\",\n\t\"paymentTerms\": \"Payment schedule and terms\",\n\t\"deliverables\": \"Timeline and deliverables description\",\n\t\"ipRights\": \"Intellectual property rights terms\",\n\t\"confidentiality\": \"Confidentiality agreement terms\",\n\t\"termination\": \"Conditions for contract termination\",\n\t\"liability\": \"Liability and warranty provisions\",\n\t\"disputeResolution\": \"Dispute resolution procedures\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1725d182-fb9d-42f2-a762-70fe2c65af6e",
      "name": "Store Contract",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        368,
        240
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "contracts"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa00980a-7701-4f50-9196-c482dd59028c",
      "name": "Generate Invoice",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        560,
        240
      ],
      "parameters": {
        "text": "=Contract: {{ $json.contractTitle }}\nClient: {{ $('Store Proposal Request').first().json.clientName }}\nClient Email: {{ $('Store Proposal Request').first().json.clientEmail }}\nTotal Amount: ${{ $('Store Proposal Request').first().json.budget }}\nPayment Due Days: {{ $('Workflow Configuration').first().json.paymentDueDays }}",
        "options": {
          "systemMessage": "You are an accounting specialist. Generate a professional invoice based on the contract details.\n\nYour invoice should include:\n1. Invoice Number (generate unique ID)\n2. Invoice Date (current date)\n3. Due Date (based on payment terms)\n4. Bill To (client information)\n5. Itemized Services (from contract scope)\n6. Subtotal, Tax, and Total Amount\n7. Payment Instructions\n8. Terms and Conditions\n\nFormat the invoice professionally and include all necessary financial details."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "a9c90470-0e96-4dc2-b44c-722d16cf1b3c",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        576,
        464
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "7af342ad-5fd4-490b-a38d-f8edb95c924b",
      "name": "Invoice Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        704,
        464
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"invoiceNumber\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Unique invoice number\"\n\t\t},\n\t\t\"invoiceDate\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Invoice date\"\n\t\t},\n\t\t\"dueDate\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Payment due date\"\n\t\t},\n\t\t\"billTo\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Client billing information\"\n\t\t},\n\t\t\"itemizedServices\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Itemized services list\"\n\t\t},\n\t\t\"subtotal\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Subtotal amount\"\n\t\t},\n\t\t\"tax\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Tax amount\"\n\t\t},\n\t\t\"totalAmount\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Total amount due\"\n\t\t},\n\t\t\"paymentInstructions\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Payment instructions\"\n\t\t},\n\t\t\"status\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Invoice status (pending, paid, overdue)\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7cd05ac4-bc5a-4841-87c9-feeb87784a0d",
      "name": "Store Invoice",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        832,
        240
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "invoices"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f7313bb5-3ce5-44b9-901b-8c48821452e8",
      "name": "Send Invoice to Client",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1024,
        240
      ],
      "parameters": {
        "sendTo": "={{ $('Store Proposal Request').first().json.clientEmail }}",
        "message": "=<h2>Invoice</h2><p>Dear {{ $('Store Proposal Request').first().json.clientName }},</p><p>Please find your invoice below:</p><hr><p><strong>Invoice Number:</strong> {{ $json.invoiceNumber }}</p><p><strong>Invoice Date:</strong> {{ $json.invoiceDate }}</p><p><strong>Due Date:</strong> {{ $json.dueDate }}</p><hr><h3>Bill To</h3><p>{{ $json.billTo }}</p><hr><h3>Services</h3><p>{{ $json.itemizedServices }}</p><hr><p><strong>Subtotal:</strong> ${{ $json.subtotal }}</p><p><strong>Tax:</strong> ${{ $json.tax }}</p><p><strong>Total Amount Due:</strong> ${{ $json.totalAmount }}</p><hr><h3>Payment Instructions</h3><p>{{ $json.paymentInstructions }}</p><p>Thank you for your business!</p>",
        "options": {},
        "subject": "=Invoice {{ $json.invoiceNumber }} - {{ $('Store Proposal Request').first().json.projectTitle }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e9d526ee-5769-491e-8d06-9d8d75bdf4e0",
      "name": "Payment Monitor Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1952,
        864
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5e2ab5c7-a55f-4dcb-bdc5-5f71dac8d9f6",
      "name": "Get Pending Invoices",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1728,
        864
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "status",
              "keyValue": "pending"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "invoices"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e31a787e-4c47-40c2-9b51-918c4d4d8cee",
      "name": "Check Payment Status",
      "type": "n8n-nodes-base.code",
      "position": [
        -1504,
        864
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst results = items.map(item => {\n  const dueDate = new Date(item.json.dueDate);\n  const today = new Date();\n  const diffTime = today - dueDate;\n  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\n  return {\n    json: {\n      ...item.json,\n      daysOverdue: diffDays,\n      isOverdue: diffDays > 0\n    }\n  };\n});\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "2469dec8-3ec3-45d6-9bd4-a3936fd49e75",
      "name": "Check If Payment Overdue",
      "type": "n8n-nodes-base.if",
      "position": [
        -1280,
        864
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $('Check Payment Status').item.json.isOverdue }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1fb908e2-74c7-4a25-b79e-c7f913c27fb6",
      "name": "Send Payment Reminder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1056,
        864
      ],
      "parameters": {
        "sendTo": "={{ $json.billTo.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/)?.[0] || $('Store Proposal Request').first().json.clientEmail }}",
        "message": "=<h2>Payment Reminder</h2><p>Dear Customer,</p><p>This is a friendly reminder that invoice <strong>{{ $json.invoiceNumber }}</strong> is now <strong>{{ $json.daysOverdue }} days overdue</strong>.</p><hr><p><strong>Invoice Number:</strong> {{ $json.invoiceNumber }}</p><p><strong>Due Date:</strong> {{ $json.dueDate }}</p><p><strong>Amount Due:</strong> ${{ $json.totalAmount }}</p><hr><p>Please submit payment at your earliest convenience. If you have already paid, please disregard this notice.</p><p>{{ $json.paymentInstructions }}</p><p>If you have any questions, please contact us.</p><p>Thank you!</p>",
        "options": {},
        "subject": "=Payment Reminder: Invoice {{ $json.invoiceNumber }} - {{ $json.daysOverdue }} Days Overdue"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "000b8555-8d62-4b66-9958-ce85ad40927d",
      "name": "Update CRM",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -832,
        864
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.crmApiUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={ \"invoiceNumber\": $json.invoiceNumber, \"clientEmail\": $json.billTo, \"status\": \"reminder_sent\", \"daysOverdue\": $json.daysOverdue, \"amount\": $json.totalAmount, \"timestamp\": new Date().toISOString() }",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.3
    },
    {
      "id": "44a9be55-0be5-4dd1-87ed-49102615a7e9",
      "name": "Update Invoice Status",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -608,
        864
      ],
      "parameters": {
        "columns": {
          "value": {
            "reminderCount": "={{ $json.reminderCount + 1 }}",
            "lastReminderSent": "={{ $now.toISO() }}"
          },
          "mappingMode": "defineBelow"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "invoiceNumber",
              "keyValue": "={{ $json.invoiceNumber }}"
            }
          ]
        },
        "options": {},
        "matchType": "allConditions",
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "invoices"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "24c8fb0f-930b-4a31-899c-d3344a3961bb",
      "name": "Revenue Forecasting",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -384,
        864
      ],
      "parameters": {
        "text": "=Invoice Data: {{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are a financial analyst specializing in revenue forecasting. Analyze the invoice and payment data to generate revenue forecasts.\n\nYour forecast should include:\n1. Expected Revenue (based on invoice amounts)\n2. Collection Probability (based on payment history and overdue status)\n3. Projected Collection Date\n4. Risk Assessment (low, medium, high)\n5. Cash Flow Impact\n6. Recommendations for follow-up actions\n\nProvide data-driven insights and actionable recommendations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "03dc76fd-44a1-41fc-bde7-d9cf563140b9",
      "name": "OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -368,
        1088
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "67607f44-6641-47c5-a7b6-2f65fde5d399",
      "name": "Forecast Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -240,
        1088
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"expectedRevenue\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Expected revenue amount\"\n\t\t},\n\t\t\"collectionProbability\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Probability of collection (0-100)\"\n\t\t},\n\t\t\"projectedCollectionDate\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Projected collection date\"\n\t\t},\n\t\t\"riskAssessment\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Risk level: low, medium, or high\"\n\t\t},\n\t\t\"cashFlowImpact\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Impact on cash flow\"\n\t\t},\n\t\t\"recommendations\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Recommended follow-up actions\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "77c35f50-2f02-4ec5-b6f3-6769fbe14233",
      "name": "Store Revenue Forecast",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -16,
        976
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "revenue_forecasts"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "58fde41c-3c58-4316-8106-c3dc8ac00376",
      "name": "Prepare Follow-up Task",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        976
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "taskTitle",
              "type": "string",
              "value": "=Follow-up: {{ $('Check Payment Status').first().json.invoiceNumber }}"
            },
            {
              "id": "id-2",
              "name": "taskDescription",
              "type": "string",
              "value": "=Follow up on overdue invoice. Risk: {{ $json.riskAssessment }}. Recommendations: {{ $json.recommendations }}"
            },
            {
              "id": "id-3",
              "name": "taskPriority",
              "type": "string",
              "value": "={{ $json.riskAssessment === \"high\" ? \"urgent\" : $json.riskAssessment === \"medium\" ? \"high\" : \"normal\" }}"
            },
            {
              "id": "id-4",
              "name": "taskDueDate",
              "type": "string",
              "value": "={{ $json.projectedCollectionDate }}"
            },
            {
              "id": "id-5",
              "name": "invoiceNumber",
              "type": "string",
              "value": "={{ $('Check Payment Status').first().json.invoiceNumber }}"
            },
            {
              "id": "id-6",
              "name": "clientEmail",
              "type": "string",
              "value": "={{ $('Check Payment Status').first().json.billTo }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3305c082-eeaa-416c-a2d5-141be8bc14b1",
      "name": "Create Follow-up Task",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        976
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.taskManagementApiUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={ \"title\": $json.taskTitle, \"description\": $json.taskDescription, \"priority\": $json.taskPriority, \"dueDate\": $json.taskDueDate, \"metadata\": { \"invoiceNumber\": $json.invoiceNumber, \"clientEmail\": $json.clientEmail } }",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.3
    },
    {
      "id": "07e640e1-d8b3-416c-943a-b0833fc04398",
      "name": "Notify Rejection",
      "type": "n8n-nodes-base.gmail",
      "position": [
        16,
        528
      ],
      "parameters": {
        "sendTo": "={{ $('Store Proposal Request').first().json.clientEmail }}",
        "message": "=<h2>Proposal Status Update</h2><p>Dear {{ $('Store Proposal Request').first().json.clientName }},</p><p>Thank you for your interest in our services. After careful review, we regret to inform you that we are unable to proceed with the proposal at this time.</p><p><strong>Project:</strong> {{ $('Store Proposal Request').first().json.projectTitle }}</p><p>We appreciate your consideration and hope to work with you on future opportunities.</p><p>Best regards</p>",
        "options": {},
        "subject": "=Proposal Update: {{ $('Generate Proposal').first().json.proposalTitle }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a9f5a109-86ed-4859-bd1d-bea8049c8778",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -240
      ],
      "parameters": {
        "color": 5,
        "width": 640,
        "height": 192,
        "content": "## Customization\nModify approval logic in conditional nodes, replace OpenAI with Anthropic API\n\n## Benefits\nReduces contract processing time by 80%, eliminates approval delays, prevents invoicing errors"
      },
      "typeVersion": 1
    },
    {
      "id": "164adbfe-21d7-4f95-95bd-a5eab27a06d4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 208,
        "content": "## Setup Steps\n1. Configure OpenAI API credentials in n8n credentials manager. \n2. Connect Google Sheets account for invoice and forecast storage. \n3. Set up Gmail for approval notifications\n4. Input Stripe/payment processor credentials for payment tracking. "
      },
      "typeVersion": 1
    },
    {
      "id": "6c59d5ba-80d3-415b-81ab-85f618ffeea3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 224,
        "content": "## Prerequisites\nOpenAI API key, Google Sheets account, Gmail account, Stripe/payment processor access\n\n## Use Cases\nMulti-stage approval workflows, SaaS contract management, professional services invoicing\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f7f1adf6-a1e5-4aac-8289-eac45de1fff1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1936,
        -240
      ],
      "parameters": {
        "width": 816,
        "height": 192,
        "content": "## How It Works\nThis workflow automates end-to-end contract and invoice management using AI intelligence. It processes proposals through intelligent contract generation, approval workflows, and automated invoicing. OpenAI analyzes proposal content while the system routes approvals intelligently. Upon approval, contracts are generated, invoices created, and notifications sent. The workflow also monitors payment status, generates financial forecasts, and manages follow-up tasks, eliminating manual contract generation delays and approval bottlenecks while ensuring accurate financial record-keeping."
      },
      "typeVersion": 1
    },
    {
      "id": "5b5d94d3-148d-48ba-a783-a16e73df52d3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1984,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 592,
        "content": "## Proposal Intake & Configuration\n### What\nReceives proposal requests and configures workflow parameters via form inputs.\n### Why\nEstablishes initial data and user preferences for accurate downstream processing."
      },
      "typeVersion": 1
    },
    {
      "id": "e14f8bbc-b844-4e43-8b5c-6c20ea4ab000",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1312,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 592,
        "content": "## AI-Powered Proposal Analysis\n### What\nOpenAI analyzes proposal content using the Chat Model Reason Output Parser.\n### Why\nExtracts key business logic and decision criteria for intelligent routing."
      },
      "typeVersion": 1
    },
    {
      "id": "21a7bbcb-2180-4dea-9cbd-129e0cbceb07",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 608,
        "content": "## Intelligent Approval Routing\n### What\nRoutes proposals to appropriate approvers based on AI recommendations.\n### Why\nAccelerates approvals by directing requests to relevant stakeholders."
      },
      "typeVersion": 1
    },
    {
      "id": "5a0d0000-5f58-47d3-be28-f7e3faf12f48",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 608,
        "content": "## Contract & Invoice Generation\n### What\nAuto-generates contracts and invoices; updates payment tracking.\n### Why\nEliminates manual document creation, ensures consistency, and reduces errors."
      },
      "typeVersion": 1
    },
    {
      "id": "b0c06a76-575e-481c-b535-a272d8cde154",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1984,
        688
      ],
      "parameters": {
        "color": 7,
        "width": 3200,
        "height": 544,
        "content": "## Financial Forecasting\n### What\nGenerates revenue forecasts and tracks invoice status via Google Sheets.\n### Why\nProvides real-time financial visibility and predictive insights."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "236e8a9d-6109-446e-86fb-62306495fc07",
  "connections": {
    "Update CRM": {
      "main": [
        [
          {
            "node": "Update Invoice Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Invoice": {
      "main": [
        [
          {
            "node": "Send Invoice to Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Contract": {
      "main": [
        [
          {
            "node": "Generate Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Invoice": {
      "main": [
        [
          {
            "node": "Store Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Contract": {
      "main": [
        [
          {
            "node": "Store Contract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Proposal": {
      "main": [
        [
          {
            "node": "Store Generated Proposal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Proposal",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Approval": {
      "main": [
        [
          {
            "node": "Check Approval Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Contract",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Invoice",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Revenue Forecasting",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Revenue Forecasting": {
      "main": [
        [
          {
            "node": "Store Revenue Forecast",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Payment Status": {
      "main": [
        [
          {
            "node": "Check If Payment Overdue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Pending Invoices": {
      "main": [
        [
          {
            "node": "Check Payment Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Approval Status": {
      "main": [
        [
          {
            "node": "Generate Contract",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Rejection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Invoice",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Proposal Request Form": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Payment Reminder": {
      "main": [
        [
          {
            "node": "Update CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Invoice Status": {
      "main": [
        [
          {
            "node": "Revenue Forecasting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contract Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Contract",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Forecast Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Revenue Forecasting",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Follow-up Task": {
      "main": [
        [
          {
            "node": "Create Follow-up Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Proposal Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Proposal",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Store Proposal Request": {
      "main": [
        [
          {
            "node": "Generate Proposal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Revenue Forecast": {
      "main": [
        [
          {
            "node": "Prepare Follow-up Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Store Proposal Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Payment Overdue": {
      "main": [
        [
          {
            "node": "Send Payment Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Payment Monitor Schedule": {
      "main": [
        [
          {
            "node": "Get Pending Invoices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Generated Proposal": {
      "main": [
        [
          {
            "node": "Send Proposal for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Proposal for Approval": {
      "main": [
        [
          {
            "node": "Wait for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}