This example demonstrates how to build a Telegram bot using the Polkadot Agent Kit.
- Node.js installed on your system
- PNPM package manager
- A Telegram Bot Token (obtain from @BotFather)
-
Environment Variables
-
Create a
.envfile in the project root -
Add your Telegram bot token:
TELEGRAM_BOT_TOKEN=your_bot_token_here -
Choose ONE of the following wallet options:
Option A: Using Private Key
PRIVATE_KEY=your private ketOption B: Using Mnemonic Phrase (Recommended)
MNEMONIC_PHRASE="your mnemonic" -
Add OpenAI Key:
OPENAI_API_KEY=xxx
-
-
Install Dependencies
pnpm install --ignore-workspace
-
Start the Bot
pnpm run dev
- Interact with Polkadot ecosystem (Polkadot, Polkadot Hub, Kusama, ...) through Telegram
- Execute blockchain queries and transactions
After starting the bot:
- Open Telegram
- Search for your bot using its username
- Start interacting with commands (use /help to see available commands)