Skip to main content

Send Message

Sends a text message to a Telegram chat, user, or channel. Supports text formatting, reply-to functionality, and markdown.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Input

  • Client Id - (Optional) The unique identifier for the bot client connection obtained from the Connect node. If not provided, you can use Bot Token instead.
  • Chat Id - The target chat identifier where the message will be sent. This can be:
    • A user's Telegram ID (e.g., 123456789)
    • A group chat ID (e.g., -987654321)
    • A channel username (e.g., @mychannel)
    • A channel ID (e.g., -1001234567890)
  • Message Text - The text content to be sent. Cannot be empty. Supports up to 4096 characters.

Options

  • Bot Token - (Optional) The Telegram bot token credential. This is an alternative to using Client Id - provide either Client Id OR Bot Token.
  • Reply Id - (Optional) The message ID to reply to. If specified, the message will be sent as a reply to the referenced message. Default: 0 (no reply).
  • Parse Mode - Text formatting style for the message. Options:
    • None (default) - Plain text, no formatting
    • MarkdownV2 - Markdown formatting (recommended)
    • HTML - HTML formatting
    • Markdown - Legacy Markdown (deprecated, use MarkdownV2)

Output

  • n/a - No output

How It Works

The Send Message node sends a text message to a specified Telegram chat using the Bot API. When executed, the node:

  1. Either uses the provided Client Id or creates a temporary connection using Bot Token
  2. Validates the Chat Id and Message Text
  3. Applies the specified Parse Mode for text formatting
  4. If Reply Id is provided, sets up the message as a reply
  5. Sends the message via Telegram's Bot API
  6. Returns success or error based on the API response

Requirements

  • Either a valid Client Id from a Connect node OR a valid Bot Token credential
  • A valid Chat Id where the bot has permission to send messages
  • For channels: The bot must be an administrator
  • For groups: The bot must be a member
  • Message text must not be empty and must be under 4096 characters

Error Handling

The node will return errors in the following cases:

  • Empty or missing Chat Id
  • Empty or missing Message Text
  • Message Text exceeds 4096 characters
  • Invalid Client Id or Bot Token
  • Bot doesn't have permission to send messages to the specified chat
  • Chat not found or bot is not a member
  • Invalid Parse Mode syntax
  • Network connectivity issues
  • Telegram API errors

Usage Examples

Basic Message:

Connect → Send Message (Chat Id: 123456789, Message: "Hello!") → Disconnect

Formatted Message with MarkdownV2:

Send Message:
Chat Id: 123456789
Message: "*Bold text* _italic_ `code` [Link](https://example.com)"
Parse Mode: MarkdownV2

HTML Formatted Message:

Send Message:
Chat Id: 123456789
Message: "<b>Bold</b> <i>italic</i> <code>code</code>"
Parse Mode: HTML

Reply to a Message:

Receive Message → Send Message (Reply Id: message.message_id)

Text Formatting

MarkdownV2 Syntax

*bold text*
_italic text_
__underline__
~strikethrough~
||spoiler||
[inline link](http://example.com)
`inline code`
```pre-formatted code block```

HTML Syntax

<b>bold</b>
<i>italic</i>
<u>underline</u>
<s>strikethrough</s>
<span class="tg-spoiler">spoiler</span>
<a href="http://example.com">inline link</a>
<code>inline code</code>
<pre>pre-formatted code</pre>

Use Cases

Customer Support Bot:

Receive Message
→ Process Query
→ Send Message (response with formatted text)

Notification System:

Trigger (on event)
→ Connect
→ Send Message (alert to admin channel)
→ Disconnect

Interactive Bot:

Receive Message
→ If (contains "help")
→ Send Message (help text)
→ Else If (contains "status")
→ Send Message (status info)

Reply to User:

Receive Message
→ Extract Message ID
→ Send Message (Reply Id: message_id, Message: "Got it!")

Best Practices

  • Use MarkdownV2 for formatting - It's the recommended format and supports all features
  • Escape special characters - In MarkdownV2, escape: _, *, [, ], (, ), ~, `, >, #, +, -, =, |, {, }, ., !
  • Keep messages under 4096 characters - Split long messages into multiple Send Message nodes
  • Test formatting - Send test messages to verify formatting appears correctly
  • Handle errors gracefully - Check for permission errors and chat not found errors
  • Use Reply Id - Makes conversations easier to follow, especially in groups

Common Patterns

Multi-Line Message:

let message = `Line 1
Line 2
Line 3`;
// Use in Message Text input

Dynamic Message:

let userName = message.from.first_name;
let messageText = `Hello ${userName}! Welcome to our bot.`;

Broadcast to Multiple Chats:

For Each (chat in chatList)
→ Send Message (Chat Id: chat.id, Message: "Announcement")

Tips

  • To find a user's Chat Id, use the Receive Message node and check the from.id field
  • For channels, the Chat Id is usually negative and starts with -100
  • Use None as Parse Mode if you want to send literal markdown/HTML characters
  • The Reply Id creates a visual link to the original message in Telegram
  • You can use emojis directly in Message Text - they're fully supported
  • If you're sending messages to a channel, make sure your bot is an administrator
  • For groups with privacy mode enabled, the bot can only see messages that mention it or are replies to it