AI-powered Telegram shopping assistant with Crossmint wallet integration for seamless e-commerce experiences.
- 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
# 1. Clone and install
git clone <your-repo-url>
cd telegram-agent
npm install && cd web-interface && npm install && cd ..
# 2. Setup environment files
npm run setup
# 3. Get your API keys (see detailed instructions below)
# 4. Update .env and web-interface/.env.local with your keys
# 5. One command to start everything!
npm run dev:fullThis automatically:
- β Starts ngrok tunnels
- β Updates all environment files with ngrok URLs
- β Starts both development servers
# 1-4. Same as above
# 5. Start ngrok tunnels
ngrok start --all --config ngrok.yml
# 6. Auto-update environment files with ngrok URLs
npm run update-urls
# 7. Start the application
npm run dev:all- Node.js 18+
- npm or yarn
- ngrok account (for local development)
- Telegram Bot Token (from @BotFather)
- OpenAI API Key
- Crossmint API Keys (staging environment)
- SearchAPI.io Key (for Amazon product search)
When creating your Crossmint API keys, ensure you enable the following scopes:
wallets.read- To fetch wallet informationwallets:transactions.create- To create transactions for purchasing productswallets:transactions.read- To check transaction statuswallets:transactions.sign- To sign transactions when delegation is enabledorders.create- To create orders for headless checkoutorders.read- To check order statusorders.update- To update orders if needed
wallets.read- To view wallet information in web interfacewallets.create- To create client-side wallets via passkey signersorders.create- To create checkout orders from client-side
You can configure API keys and scopes in your Crossmint dashboard under Project Settings > API Keys.
git clone <your-repo-url>
cd telegram-agent
npm install
cd web-interface && npm install && cd ..npm run setupThis will:
- Copy
.env.exampleto.env - Copy
web-interface/.env.exampletoweb-interface/.env.local - Show setup completion message
OR follow the manual setup below:
- Message @BotFather on Telegram
- Create new bot:
/newbot - Follow prompts and save your bot token in
.envin root directory
- Go to OpenAI Platform
- Create new API key
- Save the key (starts with
sk-) in.envin root directory
- Sign up at Crossmint Console
- Create new project
- Get both Server API Key and Client API Key
- Use staging environment for development
- Sign up at SearchAPI.io
- Get your API key from dashboard
cp .env.example .envcd web-interface
cp .env.example .env.localTelegram API sometimes may give a hard time working with http URLs, so we need ngrok to tunnel localhost.
# Option A: npm (recommended)
npm install -g ngrok
# Option B: Download from https://ngrok.com/download- Sign up at ngrok.com
- Get your authtoken from dashboard
- Configure ngrok:
ngrok config add-authtoken YOUR_NGROK_AUTHTOKENWe've included a ngrok.yml configuration file in root.
- Add your auth token to
ngrok.ymlfile - Start both tunnels:
# Start ngrok with our configuration
ngrok start --all --config ngrok.ymlThis will create two tunnels:
- Bot Server:
https://abc123.ngrok.ioβlocalhost:3000 - Web Interface:
https://def456.ngrok.ioβlocalhost:3001
Copy the ngrok URLs and update your environment files:
Main .env:
WEB_APP_URL=https://def456.ngrok.io # Web interface ngrok URLWeb Interface .env.local:
NEXT_PUBLIC_BOT_API_URL=https://abc123.ngrok.io # Bot server ngrok URL
BOT_WEBHOOK_URL=https://abc123.ngrok.io/api/webhook/wallet-created
NEXTAUTH_URL=https://def456.ngrok.io # Web interface ngrok URLnpm run dev:allThis starts:
- π€ Bot Server on
localhost:3000 - π Web Interface on
localhost:3001
Terminal 1 - Bot Server:
npm run dev:botTerminal 2 - Web Interface:
npm run dev:webTerminal 3 - ngrok (keep running):
ngrok start --all --config ngrok.yml- Find your bot on Telegram (search for your bot's username)
- Send
/startcommand - You should get a welcome message
/search wireless headphones
You should see Amazon products with "Buy with Crossmint" buttons.
- Click any "Buy with Crossmint" button
- Should redirect to web interface for wallet creation
- Complete wallet setup with email/passkey
npm run setup # Quick setup - copy environment files
npm run update-urls # Auto-update ngrok URLs in environment files
npm run dev:full # π Start everything (ngrok + URL updates + servers)
npm run dev:bot # Start bot in development mode
npm run dev:web # Start web interface in development mode
npm run dev:all # Start both bot and web interface
npm run build # Build both bot and web interface
npm run start # Start production build
npm run lint # TypeScript type checking
npm run clean # Clean build artifactscd web-interface
npm run dev # Start Next.js development server
npm run build # Build for production
npm run start # Start production server- Send any message to the bot
- Powered by GPT-4o via Vercel AI SDK
- Maintains conversation context
/search [product name]
- Searches Amazon products via SearchAPI.io
- Shows product cards with images and prices
- "Buy with Crossmint" buttons for each product
/login # Create/connect Crossmint wallet
/balance # Check wallet balance
/topup # Add funds to wallet
/logout # Sign out and clear session
/memory # See conversation history
/forget # Clear conversation history
- Environment Variables: Never commit
.envfiles - HTTPS Required: Telegram requires HTTPS for inline keyboards
- API Keys: Keep all API keys secure and rotate regularly
- Staging Environment: Use Crossmint staging for development
- Check
TELEGRAM_BOT_TOKENis correct - Verify bot server is running on port 3000
- Check ngrok tunnel is active
- Ensure
WEB_APP_URLuses HTTPS (ngrok URL) - Verify web interface is running on port 3001
- Check ngrok tunnel for web interface
- Verify
CROSSMINT_CLIENT_API_KEYis correct - Check web interface environment variables
- Ensure
NEXTAUTH_URLmatches web interface ngrok URL
- Verify
SEARCHAPI_KEYis valid - Check SearchAPI.io quota/limits
- Ensure internet connection is stable
- Verify authtoken is configured:
ngrok config check - Check if ports 3000/3001 are available
- Try restarting ngrok:
ngrok start --all --config ngrok.yml
Join our telegram chat if you have any questions.
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Ready to revolutionize shopping with AI! ππ€