---
related_nodes: ["telegram_message_trigger", "telegram_download"]
---

# Telegram Send

Sends messages and optional attachments to Telegram chats using configured bot connections. Supports text, inline keyboard reply markup, and attachments — all driven by `TextBlock` config fields that interpolate against the freeform `input` payload.

For general bot actions such as typing indicators, edits, deletion, callback answers, and reactions, use [Telegram Action](telegram_action.md).

## When to Use

- Sending workflow notifications to Telegram channels or groups
- Responding to user messages in Telegram bots
- Broadcasting alerts, reports, or summaries to Telegram
- Forwarding processed data or media to Telegram chats
- Building interactive Telegram bots that reply to users

## How It Works

The Telegram Send node connects to a configured Telegram bot and sends messages to specified chat IDs. Config fields (`chat_id`, `text`, `reply_markup`, `attachments`) are `TextBlock`s resolved against the freeform `input` payload — the author chooses the payload paths.

- **Text-only**: Requires non-empty `text`. Sends one Telegram message.
- **With attachments**: `text` is optional (empty means no default caption). Sends one Telegram message per resolved attachment. Text becomes the first attachment's caption unless that attachment has its own `caption`.
- **reply_markup**: A Telegram reply markup JSON object. Only supported for text-only sends; `reply_markup` plus attachments is rejected before sending.

Attachments come only from `config.attachments`. There is no implicit `input.attachments` or standalone `attachment` socket. `input.attachments` and `input.attachment` have no special meaning unless the author explicitly binds `config.attachments` to those paths.

Accepted attachment values:
- Runtime binary `{binary}` — bytes used directly with filename/content_type metadata.
- Binary wrapper `{ binary, filename?, content_type?, caption? }` — binary with optional overrides.
- Media reference wrapper `{ object_id, filename?, caption? }` — resolved through the durable media service.
- A flat array of any of the above.

Interpolation passes the resolved value through exactly; bind `config.attachments` to
the direct binary, wrapper, media reference, or flat array in the input payload.
Wrapper/media-reference `caption` is retained for that attachment and overrides the
top-level `text` caption.

A JSON string `config.attachments` field accepts media object references only (binary data cannot be embedded in JSON).

Per-attachment send behavior: `image/*` content type is sent as a photo; `audio/ogg` or files ending in `.ogg` are sent as voice messages; everything else is sent as a document.

## Configuration

**connection** — Telegram bot connection (ULID). Select from workspace Settings → Connections. Must be a `telegram_bot` connection type. Empty or malformed values fail validation: `Telegram bot connection is required` or `expected ULID connection id`.

**chat_id** — Chat ID to send message to (`TextBlock`). Resolves to a numeric chat ID. Supports interpolation (e.g. `{{ input.message.chat.id }}`). Must parse as an integer: `chat_id must be an integer`.

**text** — Message text (`TextBlock`). Supports Telegram markdown and interpolation. Required for text-only sends: `text is required when attachments are empty`. Optional when attachments are present.

**reply_to_message_id** — Optional message ID to reply to (literal integer). Creates a threaded reply.

**reply_markup** — Optional Telegram reply markup JSON object (`TextBlock`). Supports interpolation. Must be a JSON object, e.g. `{ "inline_keyboard": [[{ "text": "Yes", "callback_data": "yes" }]] }`. Only valid for text-only sends; attachments plus reply_markup fails with `reply_markup cannot be used with Telegram attachments`.

**attachments** — Attachment binding expression (`TextBlock`). Interpolates exactly to a runtime binary, binary wrapper, `object_id` reference wrapper, or flat array. JSON string config accepts media references only.

**retry** — Whether a request is sent again after a failure that passes: a rate limit, a busy server, a dropped connection. Off by default; see [Retries](http_get.md#retries) for how attempts and waits work. Every Bot API call is a write, sent again only when Telegram refused it before acting: the connection never opened, or Telegram answered 425 or 429. Photo, voice and document uploads go once.

## Inputs

**input** — Freeform interpolation payload. No Telegram-specific attachment convention. Config `TextBlock`s bind this payload to `chat_id`, `text`, `reply_markup`, and `attachments`.

Example input for an attachment send:

```json
{
  "message": { "chat": { "id": -1001234567890 } },
  "generated_image": { "binary": "...", "filename": "chart.png", "content_type": "image/png" }
}
```

With config:
```text
chat_id = {{ input.message.chat.id }}
attachments = {{ input.generated_image }}
```

## Outputs

**output** — Sent message details.

```json
{
  "message_id": 12345,
  "chat_id": -1001234567890,
  "text": "Message text here",
  "sent_at": 1704067200,
  "attachments": [],
  "messages": []
}
```

When attachments are present:

```json
{
  "message_id": 12345,
  "chat_id": -1001234567890,
  "text": "",
  "sent_at": 1704067200,
  "attachments": [
    { "message_id": 12345, "chat_id": -1001234567890, "attachment_type": "photo", "filename": "chart.png" }
  ],
  "messages": [
    { "provider": "telegram", "message_id": 12345, "chat_id": -1001234567890, "filename": "chart.png", "attachment_type": "photo" }
  ]
}
```

Fields:
- `message_id` — Telegram message ID of the first message sent
- `chat_id` — Chat where message was sent
- `text` — Message text or resolved caption
- `sent_at` — Unix timestamp when sent
- `attachments` — Array of sent attachment summaries. Each has `message_id`, `chat_id`, `attachment_type` (one of `photo`, `voice`, `document`), `filename`, and optional `content_type`.
- `messages` — Array of per-message Telegram results. Each has `provider`, `message_id`, `chat_id`, optional `filename`, and optional `attachment_type`.

## Examples

### Basic Text Message

```json
{
  "connection": "<telegram_connection_id>",
  "chat_id": "-1001234567890",
  "text": "Hello from Verdalia!"
}
```

### Text Message with Inline Keyboard

```json
{
  "connection": "<telegram_connection_id>",
  "chat_id": "{{ input.chat_id }}",
  "text": "Continue?",
  "reply_markup": "{\"inline_keyboard\":[[{\"text\":\"Yes\",\"callback_data\":\"form:yes\"},{\"text\":\"No\",\"callback_data\":\"form:no\"}]]}"
}
```

Use Telegram Form Callback to receive button presses.

### Dynamic Response to User

```json
{
  "connection": "<telegram_connection_id>",
  "chat_id": "{{ input.message.chat.id }}",
  "text": "Thanks {{ input.message.from.first_name }}! We received your message.",
  "reply_to_message_id": 12345
}
```

### Send Processed Image

```
[Telegram Message Trigger] → [Process Image]
    ↓
[Telegram Send]
    chat_id: {{ input.message.chat.id }}
    text: Here's your processed image!
    attachments: {{ input.processed }}
```

### Forward Voice Message

```
[Telegram Message Trigger]
    ↓
[Transcribe Audio]
    ↓
[Telegram Send]
    chat_id: {{ input.message.chat.id }}
    text: You said: {{ input.transcription }}
    attachments: {{ input.voice_file }}
```

### Send Stored PDF Documents

```
[HTML to PDF] → [Upload Media] → [Telegram Send]
    chat_id: {{ input.chat_id }}
    attachments: {{ input.media_refs }}
```

Input payload example:

```json
{
  "chat_id": "-1001234567890",
  "media_refs": [
    { "object_id": "01JEXAMPLEPDF000000000000", "filename": "report.pdf" },
    { "object_id": "01JEXAMPLECSV0000000000", "filename": "data.csv", "caption": "Source data" }
  ]
}
```

Sends each media object as a Telegram document. `text` becomes the first document caption unless that item has its own `caption`.

## Runtime Errors

| Error | Cause | Remediation |
|-------|-------|-------------|
| `Telegram bot connection is required` | Connection field is empty | Select a Telegram bot connection from Settings → Connections |
| `expected ULID connection id` | Connection field contains a malformed value | Select a valid connection from Settings → Connections |
| `chat_id must be an integer` | Chat ID resolved to a non-integer value | Ensure chat_id config resolves to a numeric chat ID |
| `text is required when attachments are empty` | Text is empty and no attachments are configured | Provide text or configure attachments |
| `reply_markup cannot be used with Telegram attachments` | Both reply_markup and attachments were configured | Send a text keyboard message separately or omit reply_markup |
| `expected ULID media object id` | A `object_id` in the attachment value is not a valid ULID | Check the media object ID came from a media-producing node |
| `Failed to resolve media object` | `object_id` does not exist or is inaccessible | Check the media object ID came from the same workspace |
| `Failed to acquire Telegram bot` | Bot connection not found or invalid | Check connection ID matches a configured connection |
| Telegram API error (e.g. `Failed to send message`) | Bot lacks permission, chat not found, or API error | Check bot permissions and chat membership |

## Common Mistakes

- **Using username instead of chat ID**: Telegram requires numeric chat IDs, not @usernames.
- **Bot not in group**: Trying to send to a group the bot isn't a member of — add the bot with appropriate permissions.
- **Empty connection or malformed connection ID**: Select a configured connection; empty fails `Telegram bot connection is required`, malformed fails `expected ULID connection id`.
- **Missing attachment permissions**: Bot doesn't have permission to send media in the target chat.
- **reply_markup with attachments**: This combination is rejected with `reply_markup cannot be used with Telegram attachments`. Send the keyboard in a separate message.

## Tips

- Use `{{ input.message.chat.id }}` to reply to the same chat that triggered the workflow.
- Reply to messages with `reply_to_message_id` to keep conversations threaded.
- For groups, the bot must be added as a member before it can send messages.
- Test your bot with a private chat first (use your own user ID as chat_id).
- Use Telegram markdown for rich formatting: `*bold*`, `_italic_`, `` `code` ``.
- Wire Telegram Download or ProcessImage output directly to `config.attachments` — runtime binary is detected and sent inline.
- For generated PDFs and other durable media, pass media object references to `config.attachments`.
- When sending attachments, keep text under 1024 characters (Telegram caption limit).
- Combine with Telegram Message Trigger to build interactive bots.
