{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "120e6838-dc95-40b6-826d-afe0e2f3898d",
      "name": "\ud83e\uddfe Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 680,
        "content": "## \ud83e\uddfe AI Receipt Data Extraction Workflow\n\n**Overview:**\nAutomates receipt processing for expense management. Upload receipts to Google Drive \u2192 VLM Run extracts data using Execute Agent \u2192 Saves to Airtable.\n\n**Key Features:**\n- \ud83d\udcc1 Auto-monitors Google Drive folder\n- \ud83e\udd16 Extracts merchant, amount, date, currency automatically by analyzing document type\n- \ud83d\udcca Saves structured data to Airtable\n- \ud83d\udcf1 Mobile-friendly uploads\n\n**Perfect for:**\n- Business expense reporting\n- Personal finance tracking\n- Accounting automation\n- Travel expenses\n\n**Requirements:**\n- VLM Run API from dashboard\n- Google Drive & Airtable OAuth2"
      },
      "typeVersion": 1
    },
    {
      "id": "e64a31b8-cfe6-4d8e-9112-d19df787d340",
      "name": "\ud83d\udcc1 Input Processing Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 680,
        "content": "## \ud83d\udcc1 Input Processing\n\n**Monitors & downloads receipt files from Google Drive.**\n\n**Process:**\n1. Watches designated Drive folder\n2. Auto-triggers on new uploads\n3. Downloads files for AI processing\n\n**Supported Formats:**\n- Images (JPG, PNG, WEBP)\n- PDF documents\n- Mobile camera uploads\n- Scanned receipts"
      },
      "typeVersion": 1
    },
    {
      "id": "e7089f8b-62a1-4883-a5a2-bce7f61518f6",
      "name": "\ud83e\udd16 AI Extraction Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        0
      ],
      "parameters": {
        "width": 400,
        "height": 680,
        "content": "## \ud83e\udd16 VLM Run Receipt Extraction\n\n**Uses VLM Run node to extract structured data from receipt images/PDFs.**\n\n**Extracts:**\n- Merchant name\n- Customer info\n- Total amount\n- Currency\n- Transaction date\n\n**Features:**\n- Handles poor quality images\n- Various receipt formats\n- OCR text recognition"
      },
      "typeVersion": 1
    },
    {
      "id": "3bf8dd58-9c22-4892-b5c8-38ce26dce71a",
      "name": "\ud83d\udcca Storage Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 680,
        "content": "## \ud83d\udcca Data Storage\n\n**Structures and stores extracted data as Airtable Records.**\n\n**Features:**\n- Clean, organized format\n- Centralized expense database\n- Auto-appends new entries\n- Analysis-ready data\n\n**Data Fields:**\n- Customer name\n- Merchant name\n- Amount & currency\n- Transaction date\n\n**Benefits:**\n- Real-time tracking\n- Easy exports\n- Mobile access"
      },
      "typeVersion": 1
    },
    {
      "id": "05206108-2827-456e-918c-518214f5bbc7",
      "name": "Monitor Receipt Uploads",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "notes": "Monitors Google Drive folder for new receipt uploads and triggers processing automatically.",
      "position": [
        480,
        480
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1E8rvLEWKguorMT36yCD1jY78G0u8g6g7",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1E8rvLEWKguorMT36yCD1jY78G0u8g6g7",
          "cachedResultName": "test_data"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cf695dc5-221f-4233-bff1-2c711d400555",
      "name": "Download  Receipt File",
      "type": "n8n-nodes-base.googleDrive",
      "notes": "Downloads receipt files from Google Drive for AI processing.",
      "position": [
        688,
        480
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {
          "binaryPropertyName": "data"
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "0266c61d-31f7-4804-aba5-7b8b2926a36e",
      "name": "VLM Run Receipt Parser",
      "type": "@vlm-run/n8n-nodes-vlmrun.vlmRun",
      "notes": "Uses VLM AI to extract merchant name, amount, currency, and date from receipt images.",
      "position": [
        896,
        480
      ],
      "parameters": {
        "operation": "executeAgent",
        "agentPrompt": "You're a Receipt Data extracting expert. Fetch the following data from the provided receipt:\nCustomer, Merchant, Amount, Currency, Date",
        "agentCallbackUrl": "https://playground.attensys.ai/webhook/agent-receipt-data"
      },
      "credentials": {
        "vlmRunApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7b5bd63d-8edc-49ad-800c-3a991cea9523",
      "name": "Format Receipt Data",
      "type": "n8n-nodes-base.set",
      "notes": "Transforms AI-extracted receipt data into clean, structured format for spreadsheet storage.",
      "position": [
        1312,
        480
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Customer",
              "value": "={{ $json.body[0].body.response.customer }}"
            },
            {
              "name": "Merchant",
              "value": "={{ $json.body[0].body.response.merchant }}"
            },
            {
              "name": "Amount",
              "value": "={{ $json.body[0].body.response.amount }}"
            },
            {
              "name": "Currency",
              "value": "={{ $json.body[0].body.response.currency }}"
            },
            {
              "name": "Date",
              "value": "={{ $json.body[0].body.response.date }}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "id": "b16bf063-a677-4dc7-a2c6-f261dad252cd",
      "name": "Create a record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1504,
        480
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appuQQOmev4FlXUlz",
          "cachedResultUrl": "https://airtable.com/appuQQOmev4FlXUlz",
          "cachedResultName": "Receipt Data"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblAlP7xMFINzScRN",
          "cachedResultUrl": "https://airtable.com/appuQQOmev4FlXUlz/tblAlP7xMFINzScRN",
          "cachedResultName": "Tasks"
        },
        "columns": {
          "value": {
            "Date": "={{ $json.Date }}",
            "Amount": "={{ $json.Amount }}",
            "Currency": "={{ $json.Currency }}",
            "Customer": "={{ $json.Customer }}",
            "Merchant": "={{ $json.Merchant }}"
          },
          "schema": [
            {
              "id": "Customer",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Customer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Merchant",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Merchant",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create",
        "authentication": "airtableOAuth2Api"
      },
      "credentials": {
        "airtableOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3e0c0aef-c23d-48cf-9491-da8004edb1c2",
      "name": "Receive Data",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1104,
        480
      ],
      "parameters": {
        "path": "agent-receipt-data",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    }
  ],
  "connections": {
    "Receive Data": {
      "main": [
        [
          {
            "node": "Format Receipt Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Receipt Data": {
      "main": [
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download  Receipt File": {
      "main": [
        [
          {
            "node": "VLM Run Receipt Parser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "VLM Run Receipt Parser": {
      "main": [
        []
      ]
    },
    "Monitor Receipt Uploads": {
      "main": [
        [
          {
            "node": "Download  Receipt File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}