{
  "name": "Enterprise Invoice Intake (Gmail \u2192 DocIntel \u2192 ClickUp \u2192 StreamPulse)",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {
          "q": "has:attachment subject:invoice"
        }
      },
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -400,
        0
      ],
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "https://docintel.ysiddo-ai-projects.app/api/v1/extract",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "options": {
          "headers": {
            "X-OmniIntel-Internal-Token": "REDACTED_SECRET"
          }
        }
      },
      "name": "DocIntel Vision OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -180,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.extracted_data.total_amount }}",
              "operation": "larger",
              "value2": 10000
            }
          ]
        }
      },
      "name": "Is High Value? (>10k)",
      "type": "n8n-nodes-base.if",
      "position": [
        40,
        0
      ]
    },
    {
      "parameters": {
        "operation": "create",
        "team": "={{$parameter.team}}",
        "space": "={{$parameter.space}}",
        "folder": "={{$parameter.folder}}",
        "list": "={{$parameter.list}}",
        "name": "=URGENT: Review High Value Invoice from {{$node[\"Gmail Trigger\"].json.from}}",
        "description": "=Total parsed: ${{$node[\"DocIntel Vision OCR\"].json.extracted_data.total_amount}}"
      },
      "name": "ClickUp Alert",
      "type": "n8n-nodes-base.clickUp",
      "position": [
        260,
        -100
      ],
      "credentials": {
        "clickUpApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "https://streampulse.ysiddo-ai-projects.app/ingest/json",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({records: [$node[\"DocIntel Vision OCR\"].json]}) }}",
        "options": {
          "headers": {
            "X-OmniIntel-Internal-Token": "REDACTED_SECRET"
          }
        }
      },
      "name": "StreamPulse Ingest",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        260,
        100
      ]
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "DocIntel Vision OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DocIntel Vision OCR": {
      "main": [
        [
          {
            "node": "Is High Value? (>10k)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is High Value? (>10k)": {
      "main": [
        [
          {
            "node": "ClickUp Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "StreamPulse Ingest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ClickUp Alert": {
      "main": [
        [
          {
            "node": "StreamPulse Ingest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}