Telegram Plugin

Introduction

The Crypto.com AI Agent SDK Telegram plugin 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.

A video demo is available in the Crypto.com AI Agent SDK X post.

Prerequisites

Get a 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.

Telegram Plugin

We need to add Telegram plugin when initializing the Agent:

Run everything

As shown in the example code, we start the Telegram bot by invoking the Agent's 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.

Troubleshooting

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.

  • Review Telegram Bot API limitations to ensure compliance with rate limits and usage guidelines.

Last updated

Was this helpful?