Docs / Strand / connectors/telegram
Telegram Connector
Send messages, photos, and documents to Telegram chats and channels from your Strand workflows via the Bot API.
Prerequisites
You need a Telegram Bot Token from @BotFather:
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts to name your bot - Copy the bot token (format:
123456789:ABCdefGhIjKlMnOpQrStUvWxYz) - Add the bot to the group or channel where you want it to send messages
Tip: To get a chat ID, add @userinfobot to the chat or send a message and check https://api.telegram.org/bot<TOKEN>/getUpdates.
Connector Setup
Create a Telegram connector from the Connectors page.
Configuration Fields
| Field | Required | Description |
|---|---|---|
| Name | Yes | Friendly name (e.g., "Alerts Bot") |
| Bot Token | Yes | Telegram bot token from @BotFather (encrypted at rest) |
| Timeout | No | Request timeout in seconds (default: 30) |
Operations
Send Message
Send a text message to a chat, group, or channel.
| Field | Required | Description |
|---|---|---|
| Chat ID | Yes | Numeric chat ID or @channel_username |
| Message Text | Yes | Message text with optional formatting. Supports Jinja templates. |
| Parse Mode | No | Text formatting: None, Markdown, MarkdownV2, or HTML |
| Silent | No | Send without notification sound (default: No) |
| Reply To Message ID | No | Message ID to reply to |
Example: Markdown message:
code
*Alert:* {{ payload.service }} is {{ payload.status }}
_Triggered at {{ payload.timestamp }}_
Example: HTML message:
html
<b>Alert:</b> {{ payload.service }} is {{ payload.status }}
<i>Triggered at {{ payload.timestamp }}</i>
Edit Message
Edit a previously sent message.
| Field | Required | Description |
|---|---|---|
| Chat ID | Yes | Chat containing the message |
| Message ID | Yes | ID of the message to edit |
| New Text | Yes | Updated message text |
| Parse Mode | No | Text formatting mode |
Send Photo
Send a photo to a chat by URL.
| Field | Required | Description |
|---|---|---|
| Chat ID | Yes | Destination chat ID |
| Photo URL | Yes | URL of the photo to send |
| Caption | No | Photo caption. Supports Jinja templates. |
| Parse Mode | No | Caption formatting mode |
Send Document
Send a document to a chat by URL.
| Field | Required | Description |
|---|---|---|
| Chat ID | Yes | Destination chat ID |
| Document URL | Yes | URL of the document to send |
| Caption | No | Document caption |
Get Updates
Get recent messages and updates received by the bot.
| Field | Required | Description |
|---|---|---|
| Offset | No | Update offset to skip already-seen updates |
| Limit | No | Maximum updates to retrieve (1-100, default: 10) |
Output
Send Message Output
json
{
"success": true,
"status": "sent",
"data": {
"chat_id": "123456789",
"message_id": 42,
"text": "Alert: API is down"
},
"service": "telegram",
"operation": "send_message"
}
Key fields for subsequent nodes:
{{ steps.node_id.output_payload.data.message_id }}: Message ID (for editing or replying){{ steps.node_id.output_payload.data.chat_id }}: Chat ID
Get Updates Output
json
{
"success": true,
"status": "completed",
"data": {
"updates": [ ... ],
"count": 5
},
"service": "telegram",
"operation": "get_updates"
}
Errors
| Error | Meaning |
|---|---|
| Telegram authentication failed | Bot token is invalid. Get a new one from @BotFather. |
| Telegram bot was blocked | The user blocked the bot or it was removed from the chat. |
| Telegram rate limited | Too many requests. The error includes the retry delay. |
| Telegram API error (400) | Bad request; check chat ID, message format, or parse mode syntax. |
Example Workflow
- Create Connector with your Telegram bot token
- Send alert message when a workflow triggers:
- Chat ID:
-100123456789(group chat) - Text:
{{ payload.severity }}: {{ payload.message }} - Parse Mode: Markdown
- Send photo with a chart:
- Chat ID:
-100123456789 - Photo URL:
{{ payload.chart_url }}
Limitations
- File uploads from disk: Not supported. Send files as URLs.
- Inline keyboards: Not currently supported. Use a custom HTTP connector for advanced Telegram features.
- Webhooks (receiving): Not supported. Use the HTTP trigger with Telegram's setWebhook API for incoming messages.
- Long polling: Get Updates is a one-shot call, not a persistent listener.
Tendrl