8
n8n 中文网amn8n.com

Telegram食物卡路里追踪器

中级

这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 7 个节点。主要使用 Openai, Function, Telegram, GoogleSheets, TelegramTrigger 等节点。 通过Telegram使用GPT-4 Vision和Google Sheets追踪食物卡路里

前置要求
  • OpenAI API Key
  • Telegram Bot Token
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移

无法加载工作流预览

导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "Telegram 食物卡路里追踪器",
  "nodes": [
    {
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        200,
        300
      ],
      "parameters": {
        "updates": [
          "message"
        ]
      },
      "credentials": {
        "telegramApi": {
          "id": "{{TELEGRAM_API_CREDENTIAL_ID}}",
          "name": "Telegram Account"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "便签:确认",
      "type": "n8n-nodes-base.telegram",
      "position": [
        400,
        300
      ],
      "parameters": {
        "text": "🧠 Thanks! I’m analyzing your food image now...",
        "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "{{TELEGRAM_API_CREDENTIAL_ID}}",
          "name": "Telegram Account"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "下载 Telegram 图片",
      "type": "n8n-nodes-base.telegram",
      "position": [
        600,
        300
      ],
      "parameters": {
        "fileId": "={{$json[\"message\"][\"photo\"][ $json[\"message\"][\"photo\"].length - 1 ][\"file_id\"]}}",
        "resource": "file",
        "operation": "download"
      },
      "credentials": {
        "telegramApi": {
          "id": "{{TELEGRAM_API_CREDENTIAL_ID}}",
          "name": "Telegram Account"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "准备二进制图片",
      "type": "n8n-nodes-base.function",
      "position": [
        800,
        300
      ],
      "parameters": {
        "functionCode": "return [{ binary: { image: items[0].binary.data } }];"
      },
      "typeVersion": 1
    },
    {
      "name": "GPT-4 Vision 分析",
      "type": "n8n-nodes-base.openai",
      "position": [
        1000,
        300
      ],
      "parameters": {
        "model": "gpt-4-vision-preview",
        "messages": [
          {
            "role": "user",
            "content": [
              {
                "text": "Describe this food and estimate its calories.",
                "type": "text"
              },
              {
                "type": "image_url",
                "image_url": "={{$binary.image.data}}"
              }
            ]
          }
        ]
      },
      "credentials": {
        "openAiApi": {
          "id": "{{OPENAI_API_CREDENTIAL_ID}}",
          "name": "OpenAI Account"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "记录到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1200,
        300
      ],
      "parameters": {
        "range": "Sheet1!A:C",
        "values": "={{ [[new Date().toISOString(), $json[\"text\"]]] }}",
        "options": {},
        "sheetId": "{{GOOGLE_SHEET_ID}}",
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleApi": {
          "id": "{{GOOGLE_API_CREDENTIAL_ID}}",
          "name": "Google Sheets Account"
        }
      },
      "typeVersion": 2
    },
    {
      "name": "发送 GPT 结果",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1400,
        300
      ],
      "parameters": {
        "text": "={{$json[\"text\"]}}",
        "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "{{TELEGRAM_API_CREDENTIAL_ID}}",
          "name": "Telegram Account"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Sticky Note: Acknowledge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4 Vision Analyze": {
      "main": [
        [
          {
            "node": "Log to Google Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send GPT Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Binary Image": {
      "main": [
        [
          {
            "node": "GPT-4 Vision Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Telegram Image": {
      "main": [
        [
          {
            "node": "Prepare Binary Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sticky Note: Acknowledge": {
      "main": [
        [
          {
            "node": "Download Telegram Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 个人效率, 多模态 AI

需要付费吗?

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

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

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

作者

Several years of Experience in AI, LLMs, Robotics, Electronics. I create N8N templates which are open-source and free!!

外部链接
在 n8n.io 查看

分享此工作流