Telegram 节点常见问题(Telegram node common issues)#
以下是一些常见的 Telegram 节点 错误和问题,以及解决或排查它们的步骤。
🌐 Here are some common errors and issues with the Telegram node and steps to resolve or troubleshoot them.
向 Telegram 通道添加机器人(Add a bot to a Telegram channel)#
要让机器人向通道发送消息,必须先将机器人添加到该通道。如果你还没有将机器人添加到通道,会看到类似以下描述的错误:
Error: Forbidden: bot is not a participant of the channel。
🌐 For a bot to send a message to a channel, you must add the bot to the channel. If you haven't added the bot to the channel, you'll see an error with a description like:
Error: Forbidden: bot is not a participant of the channel.
要向通道添加机器人:
🌐 To add a bot to a channel:
- 在 Telegram 应用中,访问目标通道并选择通道名称。
- 将通道名称标记为公共通道。
- 选择 管理员 > 添加管理员。
- 搜索机器人的用户名并选择它。
- 选择右上角的勾选标记以将机器人添加到通道。
获取聊天 ID(Get the Chat ID)#
你只能在公共频道使用 @channelusername。要与 Telegram 群组互动,你需要该群组的聊天 ID。
🌐 You can only use @channelusername on public channels. To interact with a Telegram group, you need that group's Chat ID.
获取 ID 有三种方法:
🌐 There are three ways to get that ID:
- 来自 Telegram 触发器:在工作流中使用 Telegram 触发器 节点来获取聊天 ID。该节点可以在不同事件上触发,并在成功执行后返回聊天 ID。
- 通过你的网页浏览器:在网页浏览器中打开 Telegram 并进入群聊。群组的聊天 ID 是字母“g”后面的数字序列。在 n8n 中输入群聊 ID 时,在其前面加上
-前缀。 - 将 Telegram 的 @RawDataBot 邀请到群组:添加后,机器人会输出一个包含
chat对象的 JSON 文件。该对象的id是群组聊天 ID。然后将 RawDataBot 从你的群组中移除。
每秒发送超过 30 条消息(Send more than 30 messages per second)#
Telegram API 有一个发送速率的限制,每秒只能发送 30 条消息。按照以下步骤可以发送超过 30 条消息:
🌐 The Telegram API has a limitation of sending only 30 messages per second. Follow these steps to send more than 30 messages:
- 循环处理项目节点:使用 循环处理项目 节点从你的数据库中获取最多 30 个聊天 ID。
- Telegram 节点:将 Telegram 节点与循环遍历项(Loop Over Items)节点连接。使用 表达式编辑器 从循环遍历项节点中选择聊天 ID。
- 代码节点:将代码节点与Telegram节点连接。使用代码节点在获取下一批聊天ID之前等待几秒钟。将此节点与循环处理项目节点连接。
你也可以使用这个工作流程。
🌐 You can also use this workflow.
移除已发送消息中的 n8n 属性(Remove the n8n attribution from sent messages)#
如果你使用该节点来发送 Telegram 消息,消息会自动在末尾附加 n8n 的来源信息:
🌐 If you're using the node to send Telegram messages, the message automatically gets an n8n attribution appended to the end:
此消息由 n8n 自动发送
移除此属性:
🌐 To remove this attribution:
- 在节点的附加字段部分,选择添加字段。
- 选择 添加 n8n 归属。
- 关闭开关。
有关更多信息,请参阅 发送消息附加字段。
🌐 Refer to Send Message additional fields for more information.