使用GPT-4o-mini、WhatsApp和Google表格自动化处理收据图像

中级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 13 个节点。主要使用 Code、WhatsApp、GoogleDrive、HttpRequest、GoogleSheets 等节点。 使用GPT-4o-mini、WhatsApp和Google表格自动化处理收据图像

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "d50eb300714876167b1794e0dcd96db4a91fa9bf8e6d681134014e90275219ab",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "54e0a66b-d8c4-420c-91e9-54a8e7f5eb69",
      "name": "WhatsApp触发器",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        480,
        160
      ],
      "webhookId": "3b2c3dce-039d-4c63-bd69-866e4f0de669",
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "ByYO4EttmZ8VoMMj",
          "name": "WhatsApp OAuth account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f21f409-1ec7-4745-9706-c942c3c2fb5d",
      "name": "下载媒体",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        704,
        160
      ],
      "webhookId": "1cc8b65d-be9b-4497-8275-3025e07dbb39",
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $json.messages[0].image.id }}"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "TphYieBFElbnW4HH",
          "name": "WhatsApp account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f9d581cf-4a0c-4b6b-86f1-749f99852ce3",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        928,
        160
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "RtP73NK5RnPhGYlL",
          "name": "Atharva's Whatsup"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ea1794f8-6e6c-430b-9a7d-d604b3b70a39",
      "name": "上传文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1152,
        160
      ],
      "parameters": {
        "name": "data",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1IP1KFkWq0SGE6vITKxueGzJcvTU4PIVx",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1IP1KFkWq0SGE6vITKxueGzJcvTU4PIVx",
          "cachedResultName": "Invoices"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "KTM6g5JWmYA6nlJy",
          "name": "Atharva"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e198f8cb-35de-45c1-93bc-6a855083cac7",
      "name": "分享文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1376,
        160
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "KTM6g5JWmYA6nlJy",
          "name": "Atharva"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "24ffe82f-b682-42f5-bde8-41c6ddd8993d",
      "name": "分析图片",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        480,
        384
      ],
      "parameters": {
        "text": "Your job is to extract structured data from invoice images.\nReturn the output in valid JSON only, with the following fields:\n\nstore_name: Name of the store or merchant\n\ndescription: Short summary of purchased items or services\n\nimage_url: URL of the invoice image (as provided in input)\n\npayment: Mode of payment (card, cash, UPI, wallet, other)\n\ntotal: Final total amount in numeric format\nOutput Json Only\nExample JSON output:\n{\n  \"store_name\": \"Big Bazaar\",\n  \"description\": \"3 items: rice, detergent, snacks\",\n  \"image_url\": \"https://example.com/invoice123.png\",\n  \"payment\": \"card\",\n  \"total\": 1520.75\n}\n",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "resource": "image",
        "inputType": "base64",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "id": "cRgv30Js3TBdKx3T",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "42667e8e-4011-401f-a84b-64132d14daab",
      "name": "下载文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1600,
        160
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Upload file').item.json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "KTM6g5JWmYA6nlJy",
          "name": "Atharva"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "a5b8be95-dc87-495f-a64b-e30048d545af",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        384
      ],
      "parameters": {
        "jsCode": "// Get the raw text\nconst raw = $input.first().json.content;\n\n// Remove ```json and ``` wrappers + escaped \\n\nconst cleaned = raw\n  .replace(/```json/g, \"\")\n  .replace(/```/g, \"\")\n  .replace(/\\\\n/g, \"\")\n  .trim();\n\n// Parse to JSON\nconst data = JSON.parse(cleaned);\n\nreturn [{ json: data }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "72db8e7e-bf25-4e65-96d1-2b5eccec34cc",
      "name": "在表格中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        928,
        384
      ],
      "parameters": {
        "columns": {
          "value": {
            "total": "={{ $json.total }}",
            "payment": "={{ $json.payment }}",
            "image_url": "={{ $('Upload file').item.json.webViewLink }}",
            "store name": "={{ $json.store_name }}",
            "discription": "={{ $json.description }}"
          },
          "schema": [
            {
              "id": "store name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "store name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "discription",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "discription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "image_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "image_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payment",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "payment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "total",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1cG8U5EpRXKXkM3eN74byIhQBkmfF59mLgvDc3S2xT0s/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1cG8U5EpRXKXkM3eN74byIhQBkmfF59mLgvDc3S2xT0s",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1cG8U5EpRXKXkM3eN74byIhQBkmfF59mLgvDc3S2xT0s/edit?usp=drivesdk",
          "cachedResultName": "Invoices"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "3sc7CoKBfqbnKwnY",
          "name": "Atharva"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "648037a1-c9f4-42ab-a0aa-72a4f10c2897",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1152,
        384
      ],
      "parameters": {
        "text": "=Your job is to generate a short, clear invoice summary using the extracted fields.\nAlways include emojis for readability.\nAlways include the invoice image link.\nOutput should be plain text, not JSON.\n\nRequired fields:\n\n🏬 Store Name\n\n📝 Description of items\n\n💳 Payment Method\n\n💰 Total Amount\n\n🔗 Invoice Link\n\nExample Output 1:\n🏬 Store: Berghotel Grosse Scheidegg\n📝 Items: 2 Latte Macchiato, 1 Globi, 1 Schweinschnitzel, 1 Käseplättli\n💳 Payment: Cash\n💰 Total: 54.50\n🔗 Link: https://example.com/invoice123.png\n\nExample Output 2:\n🏬 Store: Big Bazaar\n📝 Items: Rice, Detergent, Snacks\n💳 Payment: Card\n💰 Total: 1520.75\n🔗 Link: https://example.com/invoice123.png\n\nOutput Link:{{ $('Upload file').item.json.webViewLink }}\nActual Details:\nStore Name:{{ $json['store name'] }}\ndiscription: {{ $json.discription }}\ntotal:{{ $json.total }}\npayment: {{ $json.payment }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "2b68634e-c3b2-4c31-bd01-d5698b094cde",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1104,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "wxD7Ca2ccFKWxSrW",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f96dacaa-639f-41f3-87e8-5c81daabfbef",
      "name": "发送消息",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1504,
        384
      ],
      "webhookId": "ea1a5f84-034b-4314-a30c-94ce0eaf1cd4",
      "parameters": {
        "textBody": "={{ $json.output }}",
        "operation": "send",
        "phoneNumberId": "772721379258804",
        "additionalFields": {},
        "recipientPhoneNumber": "+919827442000"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "TphYieBFElbnW4HH",
          "name": "WhatsApp account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "28c0ac1c-b1f4-492e-adc4-9f4bf0530ed0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -80
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 208,
        "content": "# 🧾 WhatsApp 收据机器人"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share file": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Share file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download media": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Download media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

这是一个中级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量13
分类2
节点类型10
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 上查看 →

分享此工作流