Skip to main content
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.
  • 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.

Run the example

1

Set up your virtual environment

2

Install dependencies

3

Export your OpenAI API key

4

Run the example

Replace telegram_token and chat_id in the code, save it as telegram_tools.py, then run:
Full source: cookbook/91_tools/telegram_tools.py