On-chain AI Agent on Telegram
Last updated
Last updated
By following this example, we can build a Telegram bot that interacts with the Cronos network, allowing users to query blockchain information and perform transactions.
Having the following running and read:
AI-Agent-Service
- See Self-Hosting AI-Agent-Server to run your local AI agent;
AI-Agent-Signer-App
- See "Magic Link" Signer (Optional for on-chain transaction execution)
Set up out environment variables, which includes: Explorer API keys, OpenAI API keys and telegram bot token by:
Clone the repository and navigate to the bot directory:
Create a Python virtual environment:
Install dependencies:
Now we can start the bot by:
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 any issues:
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.