> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-redirect-agent-platform-overview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram

> Use Telegram tools with Agno agents.

Enable Agno agents to perform Telegram bot operations.

For selective functions access use `enable_` flag patterns.

## Prerequisites:

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

```python theme={null}

from agno.agent import Agent
from agno.tools.telegram import TelegramTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

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

# Example 1: All functions enabled (default behavior)
agent = Agent(
    name="telegram-full",
    tools=[
        TelegramTools(token=telegram_token, chat_id=chat_id)
    ],  # All functions enabled
    description="You are a comprehensive Telegram bot assistant with all messaging capabilities.",
    instructions=[
        "Help users with all Telegram bot operations",
        "Send messages, handle media, and manage bot interactions",
        "Provide clear feedback on bot operations",
        "Follow Telegram bot best practices",
    ],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("Send a message to the bot")
```

## Run the Example

```bash theme={null}
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/91_tools

# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate

python telegram_tools.py
```

For details, see [Telegram tool cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/telegram_tools.py).
