{
  "id": "XvCw0EuV2Z4qDQq5",
  "name": "Screen and Score Investment Deals with AI using OpenAI, Gmail, and Telegram",
  "tags": [],
  "nodes": [
    {
      "id": "d1010001-0001-4000-a000-000000000001",
      "name": "New Email Received",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        448,
        608
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "sender": "",
          "readStatus": "unread",
          "includeSpamTrash": false
        },
        "options": {
          "downloadAttachments": true
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d1010002-0002-4000-a000-000000000002",
      "name": "Deal Submission Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        224,
        416
      ],
      "parameters": {
        "path": "deal-intake",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode",
        "authentication": "headerAuth"
      },
      "typeVersion": 2
    },
    {
      "id": "d1010003-0003-4000-a000-000000000003",
      "name": "Respond - Deal Received",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        448,
        416
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\"status\": \"received\", \"message\": \"Deal submitted for screening\"}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "d1010004-0004-4000-a000-000000000004",
      "name": "Normalize Email Data",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        608
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "source",
              "type": "string",
              "value": "email"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "sender_name",
              "type": "string",
              "value": "={{ $json.from.value[0].name || $json.from.text || 'Unknown' }}"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "sender_email",
              "type": "string",
              "value": "={{ $json.from.value[0].address || '' }}"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject || 'No Subject' }}"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "email_body",
              "type": "string",
              "value": "={{ $json.textPlain || $json.text || $json.snippet || '' }}"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "has_attachments",
              "type": "boolean",
              "value": "={{ $json.attachments ? $json.attachments.length > 0 : false }}"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "received_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "d1s1+1234567890-a+1234567890",
              "name": "message_id",
              "type": "string",
              "value": "={{ $json.id || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d1010005-0005-4000-a000-000000000005",
      "name": "Normalize Webhook Data",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "source",
              "type": "string",
              "value": "webhook"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "sender_name",
              "type": "string",
              "value": "={{ $json.body.sender_name || $json.body.name || 'Unknown' }}"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "sender_email",
              "type": "string",
              "value": "={{ $json.body.sender_email || $json.body.email || '' }}"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.body.company_name || $json.body.deal_name || 'Deal Submission' }}"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "email_body",
              "type": "string",
              "value": "={{ $json.body.description || $json.body.summary || $json.body.pitch || '' }}"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "has_attachments",
              "type": "boolean",
              "value": "={{ $json.body.document_url ? true : false }}"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "received_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "d1w1+1234567890-a+1234567890",
              "name": "document_url",
              "type": "string",
              "value": "={{ $json.body.document_url || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d1010006-0006-4000-a000-000000000006",
      "name": "Build Deal Text",
      "type": "n8n-nodes-base.code",
      "position": [
        896,
        512
      ],
      "parameters": {
        "jsCode": "const item = $input.first();\nconst emailBody = item.json.email_body || '';\nconst subject = item.json.subject || '';\nlet attachmentText = '';\nconst binaryKeys = Object.keys(item.binary || {});\nfor (const key of binaryKeys) {\n  const binary = item.binary[key];\n  if (binary.mimeType === 'application/pdf' || binary.fileName?.endsWith('.pdf') || binary.mimeType?.includes('document')) {\n    attachmentText += `\\n[Attachment: ${binary.fileName}]`;\n  }\n}\nconst dealText = [`Subject: ${subject}`, `From: ${item.json.sender_name} <${item.json.sender_email}>`, '', 'Email Content:', emailBody, attachmentText ? '\\nAttachments detected: ' + attachmentText : ''].filter(Boolean).join('\\n');\nreturn [{ json: { ...item.json, deal_text: dealText, deal_text_length: dealText.length } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d1010007-0007-4000-a000-000000000007",
      "name": "Has Deal Content?",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1v1+1234567890-a+1234567890",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.deal_text_length }}",
              "rightValue": 20
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d1010008-0008-4000-a000-000000000008",
      "name": "Extract Deal Info - OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueRegularOutput",
      "position": [
        1344,
        416
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a deal screening assistant for an investment firm. Extract key information from the deal submission below.\n\nExtract the following fields and return ONLY valid JSON:\n{\n  \"company_name\": \"Name of the company seeking investment\",\n  \"industry\": \"Industry/sector\",\n  \"stage\": \"Pre-seed/Seed/Series A/Series B/Growth/Late Stage\",\n  \"business_model\": \"Brief description of how they make money\",\n  \"revenue\": \"Annual revenue if mentioned, or 'Not disclosed'\",\n  \"revenue_growth\": \"Growth rate if mentioned, or 'Not disclosed'\",\n  \"ask_amount\": \"How much funding they are seeking, or 'Not disclosed'\",\n  \"valuation\": \"Company valuation if mentioned, or 'Not disclosed'\",\n  \"team_size\": \"Number of employees if mentioned, or 'Not disclosed'\",\n  \"location\": \"Company HQ location if mentioned, or 'Not disclosed'\",\n  \"key_highlights\": \"2-3 sentence summary of the most compelling points\",\n  \"red_flags\": \"Any concerns or missing information worth noting\"\n}\n\nIf information is not available, use 'Not disclosed'. Be concise."
            },
            {
              "content": "={{ $json.deal_text }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "d1010009-0009-4000-a000-000000000009",
      "name": "Merge Deal Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1696,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "company_name",
              "type": "string",
              "value": "={{ $json.message.content.company_name || 'Unknown Company' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "industry",
              "type": "string",
              "value": "={{ $json.message.content.industry || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "stage",
              "type": "string",
              "value": "={{ $json.message.content.stage || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "business_model",
              "type": "string",
              "value": "={{ $json.message.content.business_model || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "revenue",
              "type": "string",
              "value": "={{ $json.message.content.revenue || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "revenue_growth",
              "type": "string",
              "value": "={{ $json.message.content.revenue_growth || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "ask_amount",
              "type": "string",
              "value": "={{ $json.message.content.ask_amount || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "valuation",
              "type": "string",
              "value": "={{ $json.message.content.valuation || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "team_size",
              "type": "string",
              "value": "={{ $json.message.content.team_size || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "location",
              "type": "string",
              "value": "={{ $json.message.content.location || 'Not disclosed' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "key_highlights",
              "type": "string",
              "value": "={{ $json.message.content.key_highlights || '' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "red_flags",
              "type": "string",
              "value": "={{ $json.message.content.red_flags || 'None noted' }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "source",
              "type": "string",
              "value": "={{ $('Build Deal Text').item.json.source }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "sender_name",
              "type": "string",
              "value": "={{ $('Build Deal Text').item.json.sender_name }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "sender_email",
              "type": "string",
              "value": "={{ $('Build Deal Text').item.json.sender_email }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "received_at",
              "type": "string",
              "value": "={{ $('Build Deal Text').item.json.received_at }}"
            },
            {
              "id": "d1m1+1234567890-a+1234567890",
              "name": "deal_text",
              "type": "string",
              "value": "={{ $('Build Deal Text').item.json.deal_text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d1010010-0010-4000-a000-000000000010",
      "name": "Score Deal - OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueRegularOutput",
      "position": [
        1920,
        416
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a deal scoring assistant for an investment firm. Score this deal on a scale of 1-10 for each criterion.\n\nScoring criteria:\n1. Industry Fit (1-10): Is this in a high-growth, investable sector?\n2. Revenue Stage (1-10): Is there meaningful traction? (Pre-revenue=2, Early revenue=5, Strong revenue=8, Scaled=10)\n3. Growth Trajectory (1-10): Are growth signals strong? (Declining=1, Flat=3, Moderate=5, High=8, Exceptional=10)\n4. Team Strength (1-10): Does the team have relevant experience and credibility?\n5. Deal Clarity (1-10): Is the pitch clear, well-structured, and complete?\n\nReturn ONLY valid JSON:\n{\n  \"industry_fit\": 7,\n  \"revenue_stage\": 5,\n  \"growth_trajectory\": 6,\n  \"team_strength\": 5,\n  \"deal_clarity\": 8,\n  \"overall_score\": 6.2,\n  \"verdict\": \"PASS or REVIEW or REJECT\",\n  \"one_line_summary\": \"Brief one-line summary of the deal\",\n  \"recommendation\": \"2-3 sentence recommendation for the investment team\"\n}\n\nScoring thresholds for verdict:\n- PASS: overall_score >= 7.5\n- REVIEW: overall_score >= 5.0 and < 7.5\n- REJECT: overall_score < 5.0\n\nCalculate overall_score as weighted average: (industry_fit*0.2 + revenue_stage*0.25 + growth_trajectory*0.25 + team_strength*0.2 + deal_clarity*0.1)"
            },
            {
              "content": "=Company: {{ $json.company_name }}\nIndustry: {{ $json.industry }}\nStage: {{ $json.stage }}\nBusiness Model: {{ $json.business_model }}\nRevenue: {{ $json.revenue }}\nGrowth: {{ $json.revenue_growth }}\nAsk: {{ $json.ask_amount }}\nValuation: {{ $json.valuation }}\nTeam Size: {{ $json.team_size }}\nLocation: {{ $json.location }}\nHighlights: {{ $json.key_highlights }}\nRed Flags: {{ $json.red_flags }}\n\nFull Deal Text:\n{{ $json.deal_text.substring(0, 3000) }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "d1010011-0011-4000-a000-000000000011",
      "name": "Parse Score Results",
      "type": "n8n-nodes-base.set",
      "position": [
        2272,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "industry_fit",
              "type": "number",
              "value": "={{ $json.message.content.industry_fit || 5 }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "revenue_stage",
              "type": "number",
              "value": "={{ $json.message.content.revenue_stage || 5 }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "growth_trajectory",
              "type": "number",
              "value": "={{ $json.message.content.growth_trajectory || 5 }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "team_strength",
              "type": "number",
              "value": "={{ $json.message.content.team_strength || 5 }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "deal_clarity",
              "type": "number",
              "value": "={{ $json.message.content.deal_clarity || 5 }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "overall_score",
              "type": "number",
              "value": "={{ $json.message.content.overall_score || 5 }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "verdict",
              "type": "string",
              "value": "={{ $json.message.content.verdict || 'REVIEW' }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "one_line_summary",
              "type": "string",
              "value": "={{ $json.message.content.one_line_summary || '' }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "recommendation",
              "type": "string",
              "value": "={{ $json.message.content.recommendation || '' }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "company_name",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.company_name }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "industry",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.industry }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "stage",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.stage }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "ask_amount",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.ask_amount }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "revenue",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.revenue }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "key_highlights",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.key_highlights }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "red_flags",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.red_flags }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "sender_name",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.sender_name }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "sender_email",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.sender_email }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "received_at",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.received_at }}"
            },
            {
              "id": "d1f1+1234567890-a+1234567890",
              "name": "source",
              "type": "string",
              "value": "={{ $('Merge Deal Fields').item.json.source }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d1010012-0012-4000-a000-000000000012",
      "name": "Is PASS?",
      "type": "n8n-nodes-base.if",
      "position": [
        2496,
        416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1r1+1234567890-a+1234567890",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.verdict }}",
              "rightValue": "PASS"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d1010013-0013-4000-a000-000000000013",
      "name": "Is REVIEW?",
      "type": "n8n-nodes-base.if",
      "position": [
        2720,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1r1+1234567890-a+1234567890",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.verdict }}",
              "rightValue": "REVIEW"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d1010014-0014-4000-a000-000000000014",
      "name": "Telegram - PASS Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2944,
        224
      ],
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d1010015-0015-4000-a000-000000000015",
      "name": "Telegram - REVIEW Notice",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2944,
        416
      ],
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d1010016-0016-4000-a000-000000000016",
      "name": "Telegram - REJECT Log",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2944,
        608
      ],
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d1010017-0017-4000-a000-000000000017",
      "name": "Log Deal to Pipeline Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3168,
        416
      ],
      "parameters": {
        "columns": {
          "value": {
            "stage": "={{ $json.stage }}",
            "source": "={{ $json.source }}",
            "revenue": "={{ $json.revenue }}",
            "verdict": "={{ $json.verdict }}",
            "industry": "={{ $json.industry }}",
            "red_flags": "={{ $json.red_flags }}",
            "ask_amount": "={{ $json.ask_amount }}",
            "received_at": "={{ $json.received_at }}",
            "sender_name": "={{ $json.sender_name }}",
            "company_name": "={{ $json.company_name }}",
            "deal_clarity": "={{ $json.deal_clarity }}",
            "industry_fit": "={{ $json.industry_fit }}",
            "sender_email": "={{ $json.sender_email }}",
            "overall_score": "={{ $json.overall_score }}",
            "revenue_stage": "={{ $json.revenue_stage }}",
            "team_strength": "={{ $json.team_strength }}",
            "key_highlights": "={{ $json.key_highlights }}",
            "recommendation": "={{ $json.recommendation }}",
            "one_line_summary": "={{ $json.one_line_summary }}",
            "growth_trajectory": "={{ $json.growth_trajectory }}"
          },
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Deal Pipeline",
          "cachedResultName": "Deal Pipeline"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "d1010018-0018-4000-a000-000000000018",
      "name": "Stop - No Deal Content",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        1408,
        608
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5c37b238-9cc3-467c-a033-f1a351f46b24",
      "name": "Section - Intake",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        256
      ],
      "parameters": {
        "color": 4,
        "width": 1060,
        "height": 546,
        "content": "### Intake & validate\nDeals enter via Gmail or webhook. Both paths normalize into the same fields. Build Deal Text combines everything into a single string for AI processing. Empty submissions are stopped."
      },
      "typeVersion": 1
    },
    {
      "id": "a0405eda-4270-4d7c-8566-da33c7ceb409",
      "name": "Section - Screen",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        272
      ],
      "parameters": {
        "color": 6,
        "width": 1138,
        "height": 532,
        "content": "### AI extraction & scoring\nFirst OpenAI call extracts structured deal info. Second call scores on 5 weighted criteria (industry fit, revenue, growth, team, clarity) and assigns a verdict."
      },
      "typeVersion": 1
    },
    {
      "id": "b809330a-b9c1-4a90-8b4b-6e20e6d666b7",
      "name": "Section - Route",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2416,
        80
      ],
      "parameters": {
        "color": "#27192E",
        "width": 920,
        "height": 726,
        "content": "### Route & log\nRoutes by verdict: PASS (7.5+), REVIEW (5-7.4), REJECT (<5). Each tier gets a Telegram notification. All deals are appended to the Google Sheets pipeline."
      },
      "typeVersion": 1
    },
    {
      "id": "ff2c6e64-9793-49bb-89c2-4cc0c783bf1d",
      "name": "Warning",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        128
      ],
      "parameters": {
        "color": 3,
        "width": 412,
        "height": 120,
        "content": "**Dont forget to** Replace YOUR_TELEGRAM_CHAT_ID in all three Telegram nodes and YOUR_GOOGLE_SHEET_ID in the Log Deal node before activating. Connect all five credentials (Gmail, OpenAI, Telegram, Sheets, Header Auth)."
      },
      "typeVersion": 1
    },
    {
      "id": "26548bc4-55b0-4894-8252-55156547ed3f",
      "name": "Main Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -144
      ],
      "parameters": {
        "width": 640,
        "height": 944,
        "content": "## Screen and Score Investment Deals with AI\n\nScreens incoming deal submissions via email or webhook, extracts key data with OpenAI, scores against 5 weighted investment criteria, and sends Telegram alerts by verdict.\n\n### How it works\n\n1. **New Email Received** polls Gmail for unread emails, or **Deal Submission Webhook** accepts POST requests from forms and APIs\n2. **Normalize Email/Webhook Data** standardizes both paths into the same fields\n3. **Build Deal Text** combines all info into a single string. **Has Deal Content?** stops empty submissions\n4. **Extract Deal Info** (GPT-4o-mini) pulls structured data: company, industry, stage, revenue, ask, team, highlights, and red flags\n5. **Merge Deal Fields** combines AI output with original metadata (sender, source, timestamp)\n6. **Score Deal** (GPT-4o-mini) scores on 5 weighted criteria and assigns PASS (7.5+) / REVIEW (5-7.4) / REJECT (<5)\n7. **Parse Score Results** extracts scores, then routes to **Telegram** alerts by tier. All deals logged to **Log Deal to Pipeline Sheet**\n\n### Setup\n\n- [ ] Connect Gmail, OpenAI, Telegram Bot, and Google Sheets credentials\n- [ ] Replace YOUR_TELEGRAM_CHAT_ID in each Telegram node\n- [ ] Create a Google Sheet with a \"Deal Pipeline\" tab (columns listed in the sheet node)\n- [ ] Replace YOUR_GOOGLE_SHEET_ID in the Log Deal node\n- [ ] Set webhook auth header if using the API intake path\n\n### Customization\n\n- Edit scoring criteria and weight thresholds in the Score Deal prompt\n- Swap Telegram for Slack or email notifications\n- Connect to a CRM instead of Google Sheets"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "7148cdc6-ff43-4b09-be96-b6ba040d8dfb",
  "connections": {
    "Is PASS?": {
      "main": [
        [
          {
            "node": "Telegram - PASS Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Is REVIEW?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is REVIEW?": {
      "main": [
        [
          {
            "node": "Telegram - REVIEW Notice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram - REJECT Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Deal Text": {
      "main": [
        [
          {
            "node": "Has Deal Content?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Deal Content?": {
      "main": [
        [
          {
            "node": "Extract Deal Info - OpenAI",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Stop - No Deal Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Deal Fields": {
      "main": [
        [
          {
            "node": "Score Deal - OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Email Received": {
      "main": [
        [
          {
            "node": "Normalize Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Score Results": {
      "main": [
        [
          {
            "node": "Is PASS?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score Deal - OpenAI": {
      "main": [
        [
          {
            "node": "Parse Score Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Email Data": {
      "main": [
        [
          {
            "node": "Build Deal Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram - PASS Alert": {
      "main": [
        [
          {
            "node": "Log Deal to Pipeline Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram - REJECT Log": {
      "main": [
        [
          {
            "node": "Log Deal to Pipeline Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Webhook Data": {
      "main": [
        [
          {
            "node": "Build Deal Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deal Submission Webhook": {
      "main": [
        [
          {
            "node": "Respond - Deal Received",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond - Deal Received": {
      "main": [
        [
          {
            "node": "Normalize Webhook Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram - REVIEW Notice": {
      "main": [
        [
          {
            "node": "Log Deal to Pipeline Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Deal Info - OpenAI": {
      "main": [
        [
          {
            "node": "Merge Deal Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}