跳转至

Telegram 节点消息操作#

使用这些操作在聊天中发送、编辑和删除消息;向聊天发送文件;以及从聊天中置顶/取消置顶消息。请参考 Telegram 获取更多关于 Telegram 节点本身的信息。

将机器人添加到频道

要使用这些操作中的大多数功能,您必须将机器人添加到频道中,以便它可以向该频道发送消息。更多信息请参考 常见问题 | 将机器人添加到 Telegram 频道

此节点可用作 AI 工具

此节点可用于增强 AI 代理的能力。以这种方式使用时,许多参数可以自动设置,或通过 AI 指导的信息进行设置 - 在 AI 工具参数文档 中了解更多信息。

删除聊天消息#

使用此操作通过 Bot API deleteMessage 方法从聊天中删除消息。

输入以下参数:

  • 连接凭证:创建或选择现有的 Telegram 凭证
  • 资源:选择 Message(消息)
  • 操作:选择 Delete Chat Message(删除聊天消息)
  • Chat ID:输入您希望删除消息的频道的聊天 ID 或用户名,格式为 @channelusername
  • Message ID:输入您要删除的消息的唯一标识符。

更多信息请参考 Telegram Bot API deleteMessage 文档。

编辑消息文本#

使用此操作通过 Bot API editMessageText 方法编辑现有消息的文本。

输入以下参数:

  • 连接凭证:创建或选择现有的 Telegram 凭证
  • 资源:选择 Message(消息)
  • 操作:选择 Edit Message Text(编辑消息文本)
  • Chat ID:输入您希望编辑消息的频道的聊天 ID 或用户名,格式为 @channelusername
  • Message ID:输入您要编辑的消息的唯一标识符。
  • Reply Markup:选择是否使用 Inline Keyboard(内联键盘) 来显示 InlineKeyboardMarkup 或选择 None(无) 不显示。这将设置 reply_markup 参数。更多信息请参考 InlineKeyboardMarkup 文档。
  • Text:输入您希望将消息编辑为的文本。

更多信息请参考 Telegram Bot API editMessageText 文档。

编辑消息文本附加字段#

使用 附加字段 进一步优化节点的行为。选择 添加字段 来添加以下任何选项:

  • 禁用网页预览:选择是否要为此消息中的链接启用链接预览(关闭)或禁用链接预览(开启)。这将为 is_disabled 设置 link_preview_options 参数。更多信息请参考 LinkPreviewOptions 文档。
  • 解析模式:选择消息应该使用 HTML(默认)、Markdown (Legacy)(传统Markdown)或 MarkdownV2 进行解析。这将设置 parse_mode 参数。

置顶聊天消息#

使用此操作通过 Bot API pinChatMessage 方法为聊天置顶消息。

输入以下参数:

  • 连接凭证:创建或选择现有的 Telegram 凭证
  • 资源:选择 Message(消息)
  • 操作:选择 Pin Chat Message(置顶聊天消息)
  • Chat ID:输入您希望置顶消息的频道的聊天 ID 或用户名,格式为 @channelusername
  • Message ID:输入您要置顶的消息的唯一标识符。

更多信息请参考 Telegram Bot API pinChatMessage 文档。

置顶聊天消息附加字段#

使用 附加字段 进一步优化节点的行为。选择 添加字段 来添加以下任何选项:

  • 禁用通知:默认情况下,Telegram 将通知所有聊天成员该消息已被置顶。如果您不想发出这些通知,请开启此控制。将 disable_notification 参数设置为 true

发送动画#

使用此操作通过 Bot API sendAnimation 方法向聊天发送 GIF 或不超过 50 MB 的无声 H.264/MPEG-4 AVC 视频。

输入以下参数:

  • 连接凭证:创建或选择现有的 Telegram 凭证
  • 资源:选择 Message(消息)
  • 操作:选择 Send Animation(发送动画)
  • Chat ID:输入您希望发送动画的频道的聊天 ID 或用户名,格式为 @channelusername
  • 二进制文件:要从节点本身发送二进制文件,请开启此选项。如果开启此参数,您必须输入包含要发送文件的 输入二进制字段
  • 动画:如果您不使用 二进制文件,请在此处输入要发送的动画。传递 file_id 以发送 Telegram 服务器上存在的文件(推荐),或传递 HTTP URL 让 Telegram 从互联网获取文件。
  • 回复标记:使用此参数设置更多界面选项。更多信息请参考 回复标记参数

更多信息请参考 Telegram Bot API sendAnimation 文档。

Send Animation additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendAnimation method. Select Add Field to add any of the following:

  • Caption: Enter a caption text for the animation, max of 1024 characters.
  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Duration: Enter the animation's duration in seconds.
  • Height: Enter the height of the animation.
  • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Telegram's Formatting options for more information on these options.
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
  • Thumbnail: Add the thumbnail of the file sent. Ignore this field if thumbnail generation for the file is supported server-side. The thumbnail should meet these specs:
    • JPEG format
    • Less than 200 KB in size
    • Width and height less than 320px.
  • Width: Enter the width of the video clip.

Send Audio#

Use this operation to send an audio file to the chat and display it in the music player using the Bot API sendAudio method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Audio.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the audio to in the format @channelusername.
  • Binary File: To send a binary file from the node itself, turn this option on. If you turn this parameter on, you must enter the Input Binary Field containing the file you want to send.
  • Audio: If you aren't using the Binary File, enter the audio to send here. Pass a file_id to send a file that exists on the Telegram servers (recommended) or an HTTP URL for Telegram to get a file from the internet.
  • Reply Markup: Use this parameter to set more interface options. Refer to Reply Markup parameters for more information on these options and how to use them.

Refer to the Telegram Bot API sendAudio documentation for more information.

Send Audio additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendAudio method. Select Add Field to add any of the following:

  • Caption: Enter a caption text for the audio, max of 1024 characters.
  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Duration: Enter the audio's duration in seconds.
  • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Telegram's Formatting options for more information on these options.
  • Performer: Enter the name of the performer.
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
  • Title: Enter the audio track's name.
  • Thumbnail: Add the thumbnail of the file sent. Ignore this field if thumbnail generation for the file is supported server-side. The thumbnail should meet these specs:
    • JPEG format
    • Less than 200 KB in size
    • Width and height less than 320px.

Send Chat Action#

Use this operation when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less using the Bot API sendChatAction method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Chat Action.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the chat action to in the format @channelusername.
  • Action: Select the action you'd like to broadcast the bot as taking. The options here include: Find Location, Typing, Recording audio or video, and Uploading file types.

Refer to Telegram's Bot API sendChatAction documentation for more information.

Send Document#

Use this operation to send a document to the chat using the Bot API sendDocument method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Document.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the document to in the format @channelusername.
  • Binary File: To send a binary file from the node itself, turn this option on. If you turn this parameter on, you must enter the Input Binary Field containing the file you want to send.
  • Document: If you aren't using the Binary File, enter the document to send here. Pass a file_id to send a file that exists on the Telegram servers (recommended) or an HTTP URL for Telegram to get a file from the internet.
  • Reply Markup: Use this parameter to set more interface options. Refer to Reply Markup parameters for more information on these options and how to use them.

Refer to Telegram's Bot API sendDocument documentation for more information.

Send Document additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendDocument method. Select Add Field to add any of the following:

  • Caption: Enter a caption text for the file, max of 1024 characters.
  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Formatting options for more information on these options.
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
  • Thumbnail: Add the thumbnail of the file sent. Ignore this field if thumbnail generation for the file is supported server-side. The thumbnail should meet these specs:
    • JPEG format
    • Less than 200 KB in size
    • Width and height less than 320px.

Send Location#

Use this operation to send a geolocation to the chat using the Bot API sendLocation method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Location.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the location to in the format @channelusername.
  • Latitude: Enter the latitude of the location.
  • Longitude: Enter the longitude of the location.
  • Reply Markup: Use this parameter to set more interface options. Refer to Reply Markup parameters for more information on these options and how to use them.

Refer to Telegram's Bot API sendLocation documentation for more information.

Send Location additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendLocation method. Select Add Field to add any of the following:

  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.

Send Media Group#

Use this operation to send a group of photos and/or videos using the Bot API sendMediaGroup method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Media Group.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the media group to in the format @channelusername.
  • Media: Use Add Media to add different media types to your media group. For each medium, select:
    • Type: The type of media this is. Choose from Photo and Video.
    • Media File: Enter the media file to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or an HTTP URL for Telegram to get a file from the internet.
    • Additional Fields: For each media file, you can choose to add these fields:
      • Caption: Enter a caption text for the file, max of 1024 characters.
      • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Formatting options for more information on these options.

Refer to Telegram's Bot API sendMediaGroup documentation for more information.

Send Media Group additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendMediaGroup method. Select Add Field to add any of the following:

  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.

发送消息#

使用此操作通过 Bot API sendMessage 方法向聊天发送消息。

输入以下参数:

  • 连接凭证:创建或选择现有的 Telegram 凭证
  • 资源:选择 Message(消息)
  • 操作:选择 Send Message(发送消息)
  • Chat ID:输入您希望发送消息的频道的聊天 ID 或用户名,格式为 @channelusername
  • Text:输入要发送的文本,实体解析后最多 4096 个字符。

更多信息请参考 Telegram 的 Bot API sendMessage 文档。

发送消息限制

Telegram 将您可以发送的消息数量限制为每秒 30 条。如果您预期会达到此限制,请参考 每秒发送超过 30 条消息 获取建议的解决方案。

Send Message additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendMessage method. Select Add Field to add any of the following:

  • Append n8n Attribution: Choose whether to include the phrase This message was sent automatically with n8n to the end of the message (turned on, default) or not (turned off).
  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Disable WebPage Preview: Select whether you want to enable link previews for links in this message (turned off) or disable link previews for links in this message (turned on). This sets the link_preview_options parameter for is_disabled. Refer to the LinkPreviewOptions documentation for more information.
  • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Telegram's Formatting options for more information on these options.
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.

Send and Wait for Response#

Use this operation to send a message to the chat using the Bot API sendMessage method and pause the workflow execution until the user confirms the operation.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send and Wait for Response.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the message to in the format @channelusername.
  • Message: Enter the text to send.
  • Response Type: The approval or response type to use:
    • Approval: Users can approve or disapprove from within the message.
    • Free Text: Users can submit a response with a form.
    • Custom Form: Users can submit a response with a custom form.

Refer to Telegram's Bot API sendMessage documentation for more information.

Send Message limits

Telegram limits the number of messages you can send to 30 per second. If you expect to hit this limit, refer to Send more than 30 messages per second for a suggested workaround.

Send and Wait for Response additional fields#

The additional fields depend on which Response Type you choose.

Approval#

The Approval response type adds these options:

  • Type of Approval: Whether to present only an approval button or both an approval and disapproval buttons.
  • Button Label: The label for the approval or disapproval button. The default choice is ✅ Approve and ❌ Decline for approval and disapproval actions respectively.
  • Limit Wait Time: Whether the workflow will automatically resume execution after a specified time limit. This can be an interval or a specific wall time.

Free Text#

When using the Free Text response type, the following options are available:

  • Message Button Label: The label to use for message button. The default choice is Respond.
  • Response Form Title: The title of the form where users provide their response.
  • Response Form Description: A description for the form where users provide their response.
  • Response Form Button Label: The label for the button on the form to submit their response. The default choice is Submit.
  • Limit Wait Time: Whether the workflow will automatically resume execution after a specified time limit. This can be an interval or a specific wall time.

Custom Form#

When using the Custom Form response type, you build a form using the fields and options you want.

You can customize each form element with the settings outlined in the n8n Form trigger's form elements. To add more fields, select the Add Form Element button.

The following options are also available:

  • Message Button Label: The label to use for message button. The default choice is Respond.
  • Response Form Title: The title of the form where users provide their response.
  • Response Form Description: A description for the form where users provide their response.
  • Response Form Button Label: The label for the button on the form to submit their response. The default choice is Submit.
  • Limit Wait Time: Whether the workflow will automatically resume execution after a specified time limit. This can be an interval or a specific wall time.

Send Photo#

Use this operation to send a photo to the chat using the Bot API sendPhoto method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Photo.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the photo to in the format @channelusername.
  • Binary File: To send a binary file from the node itself, turn this option on. If you turn this parameter on, you must enter the Input Binary Field containing the file you want to send.
  • Photo: If you aren't using the Binary File, enter the photo to send here. Pass a file_id to send a file that exists on the Telegram servers (recommended) or an HTTP URL for Telegram to get a file from the internet.
  • Reply Markup: Use this parameter to set more interface options. Refer to Reply Markup parameters for more information on these options and how to use them.

Refer to Telegram's Bot API sendPhoto documentation for more information.

Send Photo additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendPhoto method. Select Add Field to add any of the following:

  • Caption: Enter a caption text for the file, max of 1024 characters.
  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Telegram's Formatting options for more information on these options.
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.

Send Sticker#

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers using the Bot API sendSticker method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Sticker.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the sticker to in the format @channelusername.
  • Binary File: To send a binary file from the node itself, turn this option on. If you turn this parameter on, you must enter the Input Binary Field containing the file you want to send.
  • Sticker: If you aren't using the Binary File, enter the photo to send here. Pass a file_id to send a file that exists on the Telegram servers (recommended) or an HTTP URL for Telegram to get a file from the internet.
  • Reply Markup: Use this parameter to set more interface options. Refer to Reply Markup parameters for more information on these options and how to use them.

Refer to Telegram's Bot API sendSticker documentation for more information.

Send Sticker additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendSticker method. Select Add Field to add any of the following:

  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.

Send Video#

Use this operation to send a video to the chat using the Bot API sendVideo method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Send Video.
  • Chat ID: Enter the Chat ID or username of the channel you wish to send the video to in the format @channelusername.
  • Binary File: To send a binary file from the node itself, turn this option on. If you turn this parameter on, you must enter the Input Binary Field containing the file you want to send.
  • Video: If you aren't using the Binary File, enter the video to send here. Pass a file_id to send a file that exists on the Telegram servers (recommended) or an HTTP URL for Telegram to get a file from the internet.
  • Reply Markup: Use this parameter to set more interface options. Refer to Reply Markup parameters for more information on these options and how to use them.

Refer to Telegram's Bot API sendVideo documentation for more information.

Send Video additional fields#

Use the Additional Fields to further refine the behavior of the node using optional fields in Telegram's sendVideo method. Select Add Field to add any of the following:

  • Caption: Enter a caption text for the video, max of 1024 characters.
  • Disable Notification: Choose whether to send the notification silently (turned on) or with a standard notification (turned off).
  • Duration: Enter the video's duration in seconds.
  • Height: Enter the height of the video.
  • Parse Mode: Enter the parser to use for any related text. Options include HTML (default), Markdown (Legacy), MarkdownV2. Refer to Telegram's Formatting options for more information on these options.
  • Reply To Message ID: If the message is a reply, enter the ID of the message it's replying to.
  • Message Thread ID: Enter a unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
  • Thumbnail: Add the thumbnail of the file sent. Ignore this field if thumbnail generation for the file is supported server-side. The thumbnail should meet these specs:
    • JPEG format
    • Less than 200 KB in size
    • Width and height less than 320px.
  • Width: Enter the width of the video.

Unpin Chat Message#

Use this operation to unpin a message from the chat using the Bot API unpinChatMessage method.

Enter these parameters:

  • Credential to connect with: Create or select an existing Telegram credential.
  • Resource: Select Message.
  • Operation: Select Pin Chat Message.
  • Chat ID: Enter the Chat ID or username of the channel you wish to unpin the message from in the format @channelusername.
  • Message ID: Enter the unique identifier of the message you want to unpin.

Refer to the Telegram Bot API unpinChatMessage documentation for more information.

Reply Markup parameters#

For most of the Message Send actions (such as Send Animation, Send Audio), use the Reply Markup parameter to set more interface options:

  • Force Reply: The Telegram client will act as if the user has selected the bot's message and tapped Reply, automatically displaying a reply interface to the user. Refer to Force Reply parameters for further guidance on this option.
  • Inline Keyboard: Display an inline keyboard right next to the message. Refer to Inline Keyboard parameters for further guidance on this option.
  • Reply Keyboard: Display a custom keyboard with reply options. Refer to Reply Keyboard parameters for further guidance on this option.
  • Reply Keyboard Remove: The Telegram client will remove the current custom keyboard and display the default letter-keyboard. Refer to Reply Keyboard parameters for further guidance on this option.

Telegram Business accounts

Telegram restricts the following options in channels and for messages sent on behalf of a Telegram Business account:

  • Force Reply
  • Reply Keyboard
  • Reply Keyboard Remove

Force Reply parameters#

Force Reply is useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.

If you select Reply Markup > Force Reply, choose from these Force Reply parameters:

  • Force Reply: Turn on to show the reply interface to the user, as described above.
  • Selective: Turn this on if you want to force reply from these users only:
    • Users that are @mentioned in the text of the message.
    • The sender of the original message, if this Send Animation message is a reply to a message.

Refer to ForceReply for more information.

Inline Keyboard parameters#

If you select Reply Markup > Inline Keyboard, define the inline keyboard buttons you want to display using the Add Button option. To add more rows to your keyboard, use Add Keyboard Row.

Refer to InlineKeyboardMarkup and InlineKeyboardButtons for more information.

Reply Keyboard parameters#

If you select Reply Markup > Reply Keyboard, use the Reply Keyboard section to define the buttons and rows in your Reply Keyboard.

Use the Reply Keyboard Options to further refine the keyboard's behavior:

  • Resize Keyboard: Choose whether to request the Telegram client to resize the keyboard vertically for optimal fit (turned on) or whether to use the same height as the app's standard keyboard (turned off).
  • One Time Keyboard: Choose whether the Telegram client should hide the keyboard as soon as a user uses it (turned on) or to keep displaying it (turned off).
  • Selective: Turn this on if you want to show the keyboard to these users only:
    • Users that are @mentioned in the text of the message.
    • The sender of the original message, if this Send Animation message is a reply to a message.

Refer to ReplyKeyboardMarkup for more information.

Reply Keyboard Remove parameters#

If you select Reply Markup > Reply Keyboard Remove, choose from these Reply Keyboard Remove parameters:

  • Remove Keyboard: Choose whether to request the Telegram client to remove the custom keyboard (turned on) or to keep it (turned off).
  • Selective: Turn this on if you want to remove the keyboard for these users only:
    • Users that are @mentioned in the text of the message.
    • The sender of the original message, if this Send Animation message is a reply to a message.

Refer to ReplyKeyboardRemove for more information.

此页面是否
💬 微信

🚀 与作者交流

关注公众号
n8n实战笔记公众号
n8n实战笔记
📚 教程 💡 案例 🔧 技巧
添加微信
添加作者微信
1对1 专业指导
⚡ 快答 🎯 定制 🚀 支持