> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-docs-scavio-google-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram

> Send text messages to a Telegram chat by default and enable additional TelegramTools functions explicitly.

`TelegramTools` exposes `send_message` by default. Enable media and message-management functions with their `enable_*` flags, or set `all=True` to expose every Telegram tool.

## Prerequisites

* [Create a bot with BotFather](https://core.telegram.org/bots/features#creating-a-new-bot).
* Copy the bot token from BotFather.
* Send a message to the bot.
* Get the chat ID from `https://api.telegram.org/bot<your-bot-token>/getUpdates`.

```python theme={null}
from agno.agent import Agent
from agno.tools.telegram import TelegramTools

telegram_token = "<enter-your-bot-token>"
chat_id = "<enter-your-chat-id>"

# TelegramTools exposes only send_message by default.
agent = Agent(
    name="telegram-messages",
    tools=[TelegramTools(token=telegram_token, chat_id=chat_id)],
    description="Send text messages to a Telegram chat.",
    instructions=[
        "Use send_message to send the requested text.",
        "Report whether the message was sent successfully.",
    ],
    markdown=True,
)

if __name__ == "__main__":
    agent.print_response("Send 'Hello from Agno!' to the bot")
```

## Run the example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U 'agno[telegram]' openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Replace `telegram_token` and `chat_id` in the code, save it as `telegram_tools.py`, then run:

    ```bash theme={null}
    python telegram_tools.py
    ```
  </Step>
</Steps>

Full source: [cookbook/91\_tools/telegram\_tools.py](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/telegram_tools.py)
