Telegram Send Message

Send messages via the Telegram Bot API from a workflow. Use it for bot replies, notifications, confirmations, and any programmatic messaging in Telegram.

When to Use

Use Telegram Send Message when:

  • You need to reply to a user after a Telegram Trigger event
  • You want to send notifications or confirmations from a workflow
  • You need formatted messages with Markdown or HTML
  • An AI Agent should send Telegram messages as a tool

The same TELEGRAM_BOT_TOKEN used by Telegram Trigger works for sending messages.

Inputs

HandleTypeDescription
inputanyUpstream data for template expression references in settings bindings.

Output

HandleTypeDescription
resultobjectTelegram message send result

The result (accessed as {{ telegram_message.* }}) shape:

FieldTypeDescription
successbooleanWhether the message was sent successfully
message_idnumberID of the sent message
chat_idstringChat ID the message was sent to
errorstringError message if success is false
{
  "success": true,
  "message_id": 42,
  "chat_id": "123456789",
  "error": null
}

Settings

SettingTypeDefaultDescription
chat_idstringChat ID to send the message to. Required. Supports template expression bindings.
textcode editorMessage text. Required. Supports template expression bindings.
parse_modeenumMarkdownText formatting mode: Markdown, HTML, or MarkdownV2.
reply_to_message_idnumberMessage ID to reply to (threads the response). Supports template expression bindings.

Parse Modes

ModeUsage
MarkdownLegacy Markdown: bold, italic, inline code
HTMLHTML tags: <b>, <i>, <code> formatting
MarkdownV2Strict MarkdownV2 — special characters must be escaped with a backslash

Required Secrets

Configure on the Env Vars page:

Env VarDescription
TELEGRAM_BOT_TOKENBot token from @BotFather (format: 123456:ABC-DEF...). See the Telegram bot tutorial for setup.

Example

Canvas

Reply to a user after a Telegram Trigger:

Telegram Trigger → Telegram Send Message

Telegram Send Message settings:

  • Chat ID: {{ telegram.chat_id }}
  • Message Text: Hello {{ telegram.from.first_name }}! I received your message.
  • Reply To Message ID: {{ telegram.message_id }}

Send a formatted confirmation with Markdown:

  • Chat ID: {{ telegram.chat_id }}
  • Message Text: *Order confirmed*\nYour order \#12345` has been placed.`
  • Parse Mode: Markdown

Access the result in downstream nodes:

{{ telegram_message.success }}
{{ telegram_message.message_id }}
{{ telegram_message.chat_id }}

TSL

import telegram_trigger from @tensorify/telegram-trigger:1.0.0
import telegram from @tensorify/telegram-send-message:1.0.0

node trigger @tensorify/telegram-trigger:1.0.0 {
    update_types = ["message"]
}

node reply @tensorify/telegram-send-message:1.0.0 {
    chat_id = "{{ telegram.chat_id }}"
    text = "Hello {{ telegram.from.first_name }}! I received your message."
    reply_to_message_id = "{{ telegram.message_id }}"
}

trigger.payload -> reply.input

Error Handling

Telegram Send Message has an On Error control output branch. Enable it via the "Error output handle" toggle at the bottom of the settings panel.

The error branch fires when:

  • The Telegram Bot API returns an error (invalid chat ID, bot blocked, etc.)
  • TELEGRAM_BOT_TOKEN is missing or invalid
  • Message text fails validation for the selected parse mode
  • The user has not started a conversation with the bot

Connect the error output to a fallback notification or If node. On the success path, check {{ telegram_message.success }} — the node does not automatically stop execution on failure.

Common Gotchas

  • Parse mode errors: Invalid formatting for the selected parse mode causes Telegram to reject the message. Test formatting with simple messages first.
  • MarkdownV2 escaping: Characters like ., -, (, ) must be escaped in MarkdownV2 mode.
  • Chat must exist: The user must have started a conversation with your bot before you can send them messages.
  • Reply threading: Set reply_to_message_id to thread your response under the user's original message. Use {{ telegram.message_id }} from a Telegram Trigger.
  • Check telegram_message.success: Connect the On Error branch or add an If node to handle send failures.

See Also

On this page