{
  "name": "Scan WhatsApp receipt photos and track expenses using Wati and GPT-4o",
  "nodes": [
    {
      "id": "3bf367ea-63dc-4547-aec6-5b7fd658608c",
      "name": "📋 Flow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        16
      ],
      "parameters": {
        "width": 500,
        "height": 374,
        "content": "## 📊 WhatsApp Expense Tracker – AI Receipt Scanner\n\n**How it works:**\n1. User sends a receipt photo (or text command) on WhatsApp via WATI\n2. n8n receives the webhook, detects if it's an image or text"
      }
    },
    {
      "id": "ab271019-dd04-4b53-b6ab-78b8025ca94a",
      "name": "Sticky – Receive & Route",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        400
      ],
      "parameters": {
        "width": 548,
        "height": 484,
        "content": "### 1️⃣ Webhook + Route\n**WATI Trigger** receives incoming WhatsApp messages.\n**Switch** checks: image → receipt scan | `report` text → monthly report | anything else → help message."
      }
    },
    {
      "id": "0f4b6bab-89b4-4d75-957b-d767139da255",
      "name": "Sticky – AI Scan",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        336
      ],
      "parameters": {
        "width": 808,
        "height": 420,
        "content": "### 2️⃣ Download & Scan Receipt\n**Get a media file** downloads the receipt image binary from WATI.\n**Prepare Image Code** converts the binary to a base64 data URL so OpenAI Vision can read it.\n**OpenA"
      }
    },
    {
      "id": "a81dbf8b-d435-4327-a6ff-2772794b8693",
      "name": "Sticky – Log & Confirm",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        336
      ],
      "parameters": {
        "width": 404,
        "height": 416,
        "content": "### 3️⃣ Log to Sheets + Confirm\n**Google Sheets – Append** logs the row: timestamp, phone, vendor, amount, currency, date, category, description, month.\n**WATI – Confirm** sends a session message back"
      }
    },
    {
      "id": "7cdee34e-1fc5-4f2c-8ca3-c62fa4f5a28f",
      "name": "Sticky – Report",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        784
      ],
      "parameters": {
        "width": 724,
        "height": 283,
        "content": "### 4️⃣ Monthly Report\n**Google Sheets – Read** fetches ALL rows, filtered in the Code node by current month.\n**Build Report Code** aggregates totals per category with visual % bars.\n**WATI – Send Rep"
      }
    },
    {
      "id": "01fbe3f8-b96b-4ee0-bcf2-1b867556711f",
      "name": "Route Message",
      "type": "n8n-nodes-base.switch",
      "position": [
        528,
        640
      ]
    },
    {
      "id": "88893515-d634-49d0-b457-f8b230a08a7e",
      "name": "Parse & Validate Expense",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        528
      ]
    },
    {
      "id": "411fe9db-8c1f-4319-bd11-d93161178880",
      "name": "Google Sheets – Log Expense",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1808,
        528
      ]
    },
    {
      "id": "5a3cccd1-35bd-4851-a1bc-b8051261c0ab",
      "name": "Google Sheets – Read This Month",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1008,
        912
      ]
    },
    {
      "id": "8a7e4899-b4f3-4f17-87b1-6d9d59f8a116",
      "name": "Build Monthly Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1216,
        912
      ]
    },
    {
      "id": "47eef0fa-7eb6-495b-8ba4-d78bf81c92ff",
      "name": "Prepare Image for OpenAI1",
      "type": "n8n-nodes-base.code",
      "position": [
        1136,
        528
      ]
    },
    {
      "id": "de8d0d89-cccb-4599-afff-ddb08b4f261b",
      "name": "OpenAI – Extract Receipt Data2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1312,
        528
      ]
    },
    {
      "id": "6387db9f-7a4d-403a-9017-761e6dd4b5a2",
      "name": "Wati Trigger",
      "type": "n8n-nodes-wati.watiTrigger",
      "position": [
        336,
        656
      ]
    },
    {
      "id": "f920680d-354a-41e5-871a-d8eee6847aeb",
      "name": "Get a media file1",
      "type": "n8n-nodes-wati.wati",
      "position": [
        912,
        528
      ]
    },
    {
      "id": "60f3a0b8-afad-445b-bdd6-7000bef1e452",
      "name": "Send Expenditure message",
      "type": "n8n-nodes-wati.wati",
      "position": [
        2016,
        528
      ]
    },
    {
      "id": "f7e8beab-a370-420a-af95-b03d0a044c3a",
      "name": "Send Expenditure Report - month",
      "type": "n8n-nodes-wati.wati",
      "position": [
        1424,
        912
      ]
    }
  ],
  "connections": {
    "Wati Trigger": {
      "main": [
        [
          {
            "node": "Route Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Message": {
      "main": [
        [
          {
            "node": "Get a media file1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Google Sheets – Read This Month",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a media file1": {
      "main": [
        [
          {
            "node": "Prepare Image for OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Monthly Report": {
      "main": [
        [
          {
            "node": "Send Expenditure Report - month",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Validate Expense": {
      "main": [
        [
          {
            "node": "Google Sheets – Log Expense",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Image for OpenAI1": {
      "main": [
        [
          {
            "node": "OpenAI – Extract Receipt Data2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets – Log Expense": {
      "main": [
        [
          {
            "node": "Send Expenditure message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI – Extract Receipt Data2": {
      "main": [
        [
          {
            "node": "Parse & Validate Expense",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets – Read This Month": {
      "main": [
        [
          {
            "node": "Build Monthly Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}