A smart conversational commerce platform operating natively on Telegram. This AI-first project connects small merchants and businesses (SMEs) with their end customers through an intelligent Claude 3.5 AI agent that can negotiate, search for products, and automatically generate and fulfill payment invoices.
- AI-Native Product Discovery: Customers can chat with the bot natively in natural language (e.g., "I need two nice wooden chairs under 3 million naira").
- Stateless Tool Use Context Ring: In-memory conversational state management allowing Claude to traverse entire discovery, configuration, and invoice confirmation pipelines effortlessly via Anthropic Tool Use.
- Dynamic Invoicing: Automatically generates unique multi-item shopping cart invoices, applying exact schema checks for UUID and inventory validity.
- Native Payment Gateway (Interswitch WebPAY): An incredibly streamlined checkout flow eliminating the need for standalone web applications. See details below!
- Framework: Node.js (via Express)
- Bot Engine: Telegraf API
- AI Core: Anthropic Claude SDK (
claude-haiku-4-5/claude-3-5-sonnet) - ORM & Data Layer: Prisma v6
- Database: PostgreSQL (Hosted on Supabase)
- Validation: Zod schemas for rigorous runtime type validation on all Anthropic output configurations.
A critical feature of the SmartBiz Marketplace is the way it securely and instantly captures payments without requiring the customer to log into a separate frontend or e-commerce marketplace website.
- Invoice Generation via Claude Tool Use: When a customer agrees to buy a product, Claude triggers the
create_payment_invoicetool. The Express server executes a Prisma transaction creating a secureInvoiceand an initial PENDINGTransactionrow. - Dynamic Bot Endpoints: Links to the frontend dashboard to complete the payment:
https://smart-biz-ai-webapp.vercel.app/pay/INV-uuid
The Result: The customer taps "Buy" in Telegram, the browser opens, and they are immediately gazing at the native, secure Interswitch WebPAY Portal ready to enter their card or dial a Quickteller USSD code. It's incredibly fast.
- Clone the repo
- Install dependencies:
npm i
- Configure Environment: Create a
.envfile referencing.env.example:# Mandatory Core Services DATABASE_URL="postgresql://user:pass@pooler.supabase.com:5432/postgres" // Used by Prisma ANTHROPIC_API_KEY="..." TELEGRAM_BOT_TOKEN="..." # Your Interswitch Merchant Keys INTERSWITCH_MERCHANT_CODE="your_code" INTERSWITCH_PAYABLE_CODE="your_item_id" APP_URL="https://your-ngrok.io" # Critical for the Interswitch WebHook Verification redirect
- Start the Express Application and Webhook listeners
npm run dev
- Start the Telegram Polling Daemon
npm run bot
This service operates on the strictly-typed Prisma Client. If you execute a schema change, be completely sure to synchronize the Typescript definitions using:
npx prisma generateThis prevents the Node engine from fetching stale parameters during searchProducts calls, particularly avoiding 200,000 token-overflow errors when mapping over Large Objects (like Base64 Image strings) to Claude!