Learn how to build a Telegram ecommerce bot in 10 minutes. Create AI-powered shopping assistants that sell products through simple chat messages. Step-by-step guide with code examples.
Imagine selling products through Telegram with just a simple conversation. No websites, no complicated checkout flows—just messages that convert into sales.
That's the power of agentic commerce. Your customers type "Find me wireless headphones under $50," and your bot handles everything: product search, recommendations, and instant purchase completion.
This guide will show you how to build your own Telegram ecommerce bot that can tap into millions of products from Amazon, Shopify, and other major retailers.
The Github repo for the Telegram Ecommerce Bot can be found here.
Features of the Telegram Ecommerce Bot
AI Chat: GPT-4o powered conversations
Product Search: Amazon product search with instant results
Crossmint Wallets: Client-side wallet creation with passkey signers
Delegation: Enable fast shopping with automatic transaction signing
Secure Payments: USDC payments on Base Sepolia testnet
Web Interface: Next.js app for wallet management and delegation
For this Telegram bot, we will be using Crossmint's agentic finance platform to create wallets and enable the bot to make purchases. When creating your Crossmint API keys, ensure you enable the following scopes:
Server-side API Key Scopes:
wallets.read
wallets:transactions.create
wallets:transactions.read
wallets:transactions.sign
orders.create
orders.read
orders.update
Client-side API Key Scopes:
wallets.read
wallets.create
orders.create
You can configure API keys and scopes in your Crossmint dashboard under Project Settings > API Keys.
💨 Quick Setup
1. Clone and Install
git clone <your-repo-url>
cd telegram-agent
npm install
cd web-interface && npm install && cd ..
2. Quick Setup
npm run setup
This will:
Copy .env.example to .env
Copy web-interface/.env.example to web-interface/.env.local
Show setup completion message
ngrok Setup for Local Development
Telegram API sometimes may give a hard time working with http URLs, so we need ngrok to tunnel localhost.
1. Install ngrok
npm install -g ngrok
2. Configure ngrok Account
ngrok config add-authtoken YOUR_NGROK_AUTHTOKEN
3. Start ngrok Tunnels
We've included a ngrok.yml configuration file. Start both tunnels:
Web Interface: https://def456.ngrok.io → localhost:3001
4. Update Environment Variables
Copy the ngrok URLs and update your environment files:
Main .env :
WEB_APP_URL=https://def456.ngrok.io # Web interface ngrok URL
Web Interface .env.local:
NEXT_PUBLIC_BOT_API_URL=https://abc123.ngrok.io # Bot server ngrok URLBOT_WEBHOOK_URL=https://abc123.ngrok.io/api/webhook/wallet-createdNEXTAUTH_URL=https://def456.ngrok.io # Web interface ngrok URL
Start the Application
npm run dev:all
This starts:
🤖 Bot Server on localhost:3000
🌐 Web Interface on localhost:3001
Test the Setup
1. Test Bot Connection
Find your bot on Telegram (search for your bot's username)
Send /start command
You should get a welcome message
2. Test Product Search
/search wireless headphones
You should see Amazon products with "Buy with Crossmint" buttons.
3. Test Wallet Creation
Click any "Buy with Crossmint" button
Should redirect to web interface for wallet creation
Complete wallet setup with email/passkey
Key Features Walkthrough
1. AI Chat
Send any message to the bot
Powered by GPT-4o via Vercel AI SDK
Maintains conversation context
2. Product Search
/search [product name]
Searches Amazon products via SearchAPI.io
Shows product cards with images and prices
"Buy with Crossmint" buttons for each product
3. Wallet Management
/login # Create/connect Crossmint wallet
/balance # Check wallet balance
/topup # Add funds to wallet
/logout # Sign out and clear session
5. Memory & Preferences
/memory # See conversation history
/forget # Clear conversation history
Voilà - if you've made it this far, congratulations on getting your Telegram Ecommerce Bot set up!
For notes on security, troubleshooting or ways to contribute, go to the Github repo.
The Agentic Finance Platform for AI Agent Companies
If you’re an AI agent company looking to launch fast with enterprise-grade payments infrastructure for agentic finance and no vendor lock-in, Crossmint's Agentic Finance platform is perfect for you. Our all-in-one solution for AI agent companies includes:
AI Agent Wallets: Non-custodial wallets with programmable guardrails that enable agents to manage assets securely, maintain accountability through public transaction records, and operate within configured spending limits.
World Store: An API service giving agents access to over 1 billion SKUs of real-world goods and services, with support for payments using major tokens across 40+ chains.
GOAT SDK: An open-source library offering 250+ onchain actions across 40+ blockchains, allowing agents to send stablecoins, swap tokens, and create DeFi positions with MIT license and support for major frameworks.
Credentials: Tools to authorize agents to act on users' behalf securely.
If you’re an AI agent company and want to learn more, reach out to us here!