{
  "schema_version": "1.0.0",
  "id": "bank-row-categorize",
  "title": "Categorise imported bank transactions with AI",
  "category": "finance",
  "difficulty": "intermediate",
  "featured": false,
  "description": "For each bank transaction added to a sheet, have AI suggest a category and a clean vendor name, write them back, and flag spends over 1,000.",
  "tags": [
    "bookkeeping",
    "ai-categorization",
    "google-sheets",
    "slack",
    "finance"
  ],
  "apps": [
    "Google Sheets",
    "AI by Zapier",
    "Filter by Zapier",
    "Slack"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 4 steps after the trigger",
      "Filter by Zapier",
      "AI by Zapier"
    ]
  },
  "tasks": {
    "typical": 2,
    "max": 3
  },
  "trigger": {
    "app": "Google Sheets",
    "event": "New Spreadsheet Row",
    "kind": "polling",
    "title": "New bank transaction row",
    "why": "Fires for each new transaction row, including rows pasted in bulk from a CSV.",
    "config": {
      "Drive": "My Google Drive",
      "Spreadsheet": "Bookkeeping",
      "Worksheet": "Bank import"
    },
    "outputs": [
      "row_number",
      "date",
      "description",
      "amount",
      "account"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "cat",
      "kind": "ai",
      "app": "AI by Zapier",
      "event": "Analyze and Return Data",
      "title": "Suggest vendor and category",
      "why": "Picks from a fixed category list so the sheet can be pivoted, and says when it is unsure.",
      "fields": {
        "Model": "Default (fast)",
        "Instructions": "This is one bank transaction. Return vendor (the clean merchant name, for example \"Amazon Marketplace\"), category: one of software, advertising, travel, meals, office-supplies, contractors, bank-fees, income, transfer, other, and confidence: high or low. Use low when the description does not make the merchant clear.",
        "Input data": "Date: {{trigger.date}}\nDescription: {{trigger.description}}\nAmount: {{trigger.amount}}\nAccount: {{trigger.account}}",
        "Output fields": "vendor, category, confidence"
      },
      "outputs": [
        "vendor",
        "category",
        "confidence"
      ]
    },
    {
      "key": "write",
      "kind": "action",
      "app": "Google Sheets",
      "event": "Update Spreadsheet Row",
      "title": "Write the suggestion back",
      "why": "Writes into suggestion columns, never over the bank's original description.",
      "fields": {
        "Drive": "My Google Drive",
        "Spreadsheet": "Bookkeeping",
        "Worksheet": "Bank import",
        "Row": "{{trigger.row_number}}",
        "Columns": {
          "vendor": "{{cat.vendor}}",
          "category": "{{cat.category}}",
          "confidence": "{{cat.confidence}}"
        }
      },
      "outputs": [
        "id",
        "row_number"
      ]
    },
    {
      "key": "large",
      "kind": "filter",
      "app": "Filter by Zapier",
      "event": "Only continue if...",
      "title": "Only spends over 1,000",
      "why": "Bank exports show spending as negative numbers, so \"less than -1000\" catches spends over 1,000.",
      "conditions": [
        [
          {
            "field": "{{trigger.amount}}",
            "operator": "(Number) Less than",
            "value": "-1000"
          }
        ]
      ],
      "usually": false
    },
    {
      "key": "flag",
      "kind": "action",
      "app": "Slack",
      "event": "Send Channel Message",
      "title": "Flag the large spend",
      "why": "Large outgoing payments get a look while the month is still open.",
      "fields": {
        "Channel": "#finance",
        "Message Text": "Large spend on {{trigger.date}}: {{trigger.amount}} to {{cat.vendor}} ({{cat.category}}, {{cat.confidence}} confidence). Bank text: {{trigger.description}}",
        "Send as a bot?": "Yes",
        "Bot Name": "Zap alerts",
        "Include a link to this Zap?": "No"
      },
      "outputs": [
        "ts",
        "permalink"
      ]
    }
  ]
}
