Plugin Example: Telegram
Last updated
Was this helpful?
Last updated
Was this helpful?
AI Agent SDK has a plugin mode and one of the initial plugins is the Telegram plugin, which allows users to connect the agent to their Telegram bot with just a few lines of code.
This guide demonstrates how to build a Telegram bot that interacts with the Cronos network. The bot enables users to query blockchain information and execute transactions smoothly.
Before starting, ensure you have followed the Quick Start steps till Initialize Agent
Required account: Telegram Bot Token.
Open Telegram and search for @BotFather.
Type /start and /newbot
, then follow the prompts to name your bot (must end in bot, e.g., CryptoHelper).
After creation, @BotFather will give you a TOKEN (e.g., 7008008900:AAEKe6vIwM0gokw..
), which should be safely kept.
We need to add telegram plugin when initializing the Agent:
Now start the Telegram bot by invoking Agent built-in function:
Once the bot is running, test it to ensure it’s working as expected:
Open Telegram and search for your bot using the bot name you set up with @BotFather.
Send a sample command or message, such as /start
, to see if the bot responds.
If you encounter issues during setup or execution, follow these tips:
Check your API keys to ensure they are correctly set in the environment variables.
Verify dependencies by confirming that all packages in requirements.txt
are installed.
Review Telegram Bot API limitations to ensure compliance with rate limits and usage guidelines.