Prerequisites
Example
The following agent will send a message to a Telegram chat.cookbook/14_tools/telegram_tools.py
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
chat_id | Optional[str] | None | Default chat ID. Falls back to TELEGRAM_CHAT_ID env var. |
token | Optional[str] | None | Bot token. Falls back to TELEGRAM_TOKEN env var. |
enable_send_message | bool | True | Enable send_message tool. |
enable_send_photo | bool | False | Enable send_photo tool. |
enable_send_document | bool | False | Enable send_document tool. |
enable_send_video | bool | False | Enable send_video tool. |
enable_send_audio | bool | False | Enable send_audio tool. |
enable_send_animation | bool | False | Enable send_animation tool (GIFs). |
enable_send_sticker | bool | False | Enable send_sticker tool. |
enable_edit_message | bool | False | Enable edit_message tool. |
enable_delete_message | bool | False | Enable delete_message tool. |
all | bool | False | Enable all tools. Overrides individual flags. |
Toolkit Functions
| Function | Description |
|---|---|
send_message | Send a text message to a chat. |
send_photo | Send a photo (bytes) with optional caption. |
send_document | Send a document (bytes) with filename and optional caption. |
send_video | Send a video (bytes) with optional caption. |
send_audio | Send an audio file (bytes) with optional caption and title. |
send_animation | Send an animation/GIF (bytes) with optional caption. |
send_sticker | Send a sticker (bytes). |
edit_message | Edit a previously sent message by message_id. |
delete_message | Delete a message by message_id. |
{"status": "success", "message_id": ...} on success or {"status": "error", "message": ...} on failure.