8
n8n 中文网amn8n.com

使用 OpenAI 转录 Telegram 音频

初级

这是一个AI, IT Ops领域的自动化工作流,包含 5 个节点。主要使用 Switch, Telegram, TelegramTrigger, OpenAi 等节点,结合人工智能技术实现智能自动化。 使用 OpenAI Whisper-1 转录 Telegram 语音消息

前置要求
  • Telegram Bot Token
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "JnDUKOvOXcOImSQc",
  "meta": {
    "instanceId": "9219ebc7795bea866f70aa3d977d54417fdf06c41944be95e20cfb60f992db19",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 OpenAI 转录 Telegram 音频",
  "tags": [],
  "nodes": [
    {
      "id": "9302ced1-1655-4177-87a1-8cf69a5e692d",
      "name": "获取音频文件",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1020,
        -100
      ],
      "webhookId": "73d0d328-d75b-4bb0-a1b9-81d42a2f2bfd",
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "id": "SqOmYg6P5P1Nr1mG",
          "name": "cbd bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0eb4cb08-cce3-45d4-98cc-128f2769a1db",
      "name": "转录音频",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1240,
        -100
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "id": "vupAk5StuhOafQcb",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "460ffa1f-96a2-46ea-b7b3-69256091cd2b",
      "name": "消息触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        600,
        -180
      ],
      "webhookId": "d08f35d7-e003-4e77-a26a-eb110855e027",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "SqOmYg6P5P1Nr1mG",
          "name": "cbd bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "206b4539-8536-4728-a73c-9ce74807a1ec",
      "name": "发送转录消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1420,
        -200
      ],
      "webhookId": "5c6997c0-948a-49bb-a542-10c8bf130fdd",
      "parameters": {
        "text": "={{ $json.message.text }}\n{{ $json.text }}",
        "chatId": "={{ $('Message Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "SqOmYg6P5P1Nr1mG",
          "name": "cbd bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3ecfa664-e415-4280-938b-9203209ad940",
      "name": "路由聊天输入",
      "type": "n8n-nodes-base.switch",
      "position": [
        800,
        -180
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a561aab7-4c3b-4c96-9bb7-078281b5c7d5",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "voice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b7f1055d-6651-416f-b0cd-c46e003d4f3a",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.voice }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "timezone": "Europe/Madrid",
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "versionId": "b3af0e15-d151-48d7-9e0d-1bd553e559c5",
  "connections": {
    "Get audio file": {
      "main": [
        [
          {
            "node": "Transcribe audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Trigger": {
      "main": [
        [
          {
            "node": "Route Chat Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Chat Input": {
      "main": [
        [
          {
            "node": "Send transcription message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get audio file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe audio": {
      "main": [
        [
          {
            "node": "Send transcription message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

初级 - 人工智能, IT 运维

需要付费吗?

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

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

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
Aitor | 1Node

Aitor | 1Node

@aitoralonso

Hi, I’m Aitor. At 1Node we help businesses integrate full-scale AI solutions that save time, cut costs, and increase revenue. Guaranteed. Need help implementing AI infrastructures?

外部链接
在 n8n.io 查看

分享此工作流