{
  "name": "AgentSteps · Receipts to Spreadsheet",
  "flow": [
    {
      "id": 1,
      "module": "google-email:TriggerNewEmail",
      "version": 2,
      "parameters": {
        "folder": "INBOX",
        "criteria": "ALL",
        "searchType": "gmail",
        "query": "subject:receipt has:attachment",
        "markSeen": false,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "Watch receipt emails"
        }
      }
    },
    {
      "id": 2,
      "module": "openai-gpt-3:analyzeImages",
      "version": 1,
      "parameters": {},
      "mapper": {
        "model": "gpt-4o-mini",
        "prompt": "Read this receipt. Reply in exactly this format: date | vendor | total | category. Category is one of Meals, Travel, Software, Office, Other. No other words.",
        "images": [
          {
            "type": "file",
            "fileName": "{{1.attachments[1].fileName}}",
            "fileData": "{{1.attachments[1].data}}"
          }
        ]
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "AI reads the receipt"
        }
      }
    },
    {
      "id": 3,
      "module": "google-sheets:addRow",
      "version": 2,
      "parameters": {},
      "mapper": {
        "mode": "select",
        "insertDataOption": "INSERT_ROWS",
        "valueInputOption": "USER_ENTERED",
        "spreadsheetId": "",
        "sheetId": "Sheet1",
        "includesHeaders": true,
        "values": {
          "0": "{{trim(get(split(2.result; \"|\"); 1))}}",
          "1": "{{trim(get(split(2.result; \"|\"); 2))}}",
          "2": "{{trim(get(split(2.result; \"|\"); 3))}}",
          "3": "{{trim(get(split(2.result; \"|\"); 4))}}"
        }
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "Add to Expenses"
        }
      }
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "slots": null,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    }
  }
}
