# Digi Kedai Bot ๐Ÿค– **A multi-channel AI customer-support bot that answers customers around the clock โ€” and provisions free-trial accounts with zero human involvement.** Welcome! This is the bot that runs [Digi Kedai](https://www.digikedai.com)'s customer support on Telegram and WhatsApp. It's a real, production system I built and run myself โ€” not a demo. I'm publishing the source so you can see exactly how it works, and so it can help anyone building their own AI-powered support bot. ## Try it live ๐Ÿค– **Chat with the actual bot:** [@DigiKedaiBot](https://t.me/DigiKedaiBot) on Telegram โ€” send `/start`, ask about a product (e.g. *"CZH01 ๆœ‰ๅ…่ดน็‰ˆๅ—?"*), or claim a free trial. What you're talking to is exactly the code in this repo, deployed on my own infrastructure. > ๐Ÿ‡จ๐Ÿ‡ณ [ไธญๆ–‡็‰ˆ๏ผˆChinese๏ผ‰](README.zh-CN.md) ยท ๐Ÿ“‹ [้กน็›ฎ็Šถๆ€๏ผˆProject state๏ผ‰](PROJECT_STATE.md) --- ## About me ๐Ÿ‘‹ Hi, I'm **Lee Teong Hoe** (Mr Hoelee) โ€” a full-stack developer and DevOps engineer based in Malaysia. I run **Hoelee Enterprise / SifuMail**, building websites and self-hosting infrastructure for Malaysian SMEs. I build things end-to-end: the app, the Docker stack, the Cloudflare tunnel, the database, and the AI wiring. This bot is one of those things โ€” it went from idea to a live, customer-facing Telegram bot in a couple of weeks. --- ## Why I built this bot Digi Kedai sells digital products (online courses, ebooks, templates). Every sale brings the same questions โ€” *"does this have a free preview?", "how do I get my account?", "which package should I buy?"*. Answering them manually doesn't scale for a one-person business. The bot answers those questions 24/7, retrieves the right catalogue entry by SKU or by natural language, and hands out free-trial accounts automatically โ€” so customers get instant answers and I get my time back. --- ## What you get from this bot - **24/7 customer support** โ€” answers product questions instantly, no waiting for a human. - **Real catalogue knowledge** โ€” retrieves the correct product by SKU or plain-language question, never hallucinates a price or product. - **Automatic free-trial provisioning** โ€” customers claim a trial and get an account, end-to-end, no staff involved. - **Deterministic flows** โ€” buying, trial redemption, and deep links are handled as reliable state machines, not fragile prompt engineering. - **Long-term memory** โ€” remembers each customer across sessions and channels, so follow-ups feel personal. - **Multi-channel** โ€” the same core serves Telegram and WhatsApp today, with Shopee/Lazada designed for. --- ## Tech stack - **TypeScript + Node.js + grammY**, Dockerized - **Cloudflare tunnel** webhook ingress (no public IP, no open ports) - **LiteLLM** OpenAI-compatible gateway in front of the LLM (provider-agnostic + failover) - **PostgreSQL** for conversations + user memory - **NocoDB** for free-trial provisioning (existing webhooks finish the job) ## What's inside ``` src/ ai/ agent, prompt assembly, retrieval, memory + summarizer channels/ telegram + whatsapp adapters (shared core, per-channel adapters) core/ normalized message contract, rate limiting db/ postgres schema + self-migration on startup integrations/ nocodb (trial provisioning) + n8n (tool calls) data/ generated catalogue (SKU/name/category/size/url โ€” no prices) tests/ 13 vitest suites (retrieval, trial, purchase, memory, contracts) docs/ architecture, decisions, roadmap, operations runbook ``` --- ## Quick start (development) ```bash cp .env.example .env # fill in BOT_TOKEN, LLM_API_KEY, POSTGRES_PASSWORD npm install npm run dev # tsx watch โ€” long-polling if no webhook URL set ``` ```bash npm test # vitest npm run typecheck # tsc --noEmit ``` Full architecture, setup, and runbook live in [`docs/`](docs/). --- ## Want a bot like this? Let's talk ๐Ÿš€ If you run an online store, a service business, or a community that gets flooded with the same customer questions โ€” a bot like this can answer them for you, 24/7, in your customers' language. I build custom Telegram/WhatsApp AI bots, websites, and self-hosted infrastructure for businesses. If you'd like one โ€” or you want to hire me โ€” I'd love to hear from you: - ๐Ÿ“ฑ **WhatsApp:** [+60 12-797 2969](https://wa.me/60127972969) - ๐Ÿ“ง **Email:** [me@hoelee.com](mailto:me@hoelee.com) - ๐ŸŒ **Website:** [hoelee.com](https://hoelee.com) Happy to build a bot for your business, or just chat about how this one works. --- ## License [MIT](LICENSE) ยฉ Lee Teong Hoe