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'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 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 · 📋 项目状态(Project state


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)

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
npm test                      # vitest
npm run typecheck             # tsc --noEmit

Full architecture, setup, and runbook live in 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:

Happy to build a bot for your business, or just chat about how this one works.


License

MIT © Lee Teong Hoe

S
Description
Multi-channel AI customer-support bot for Digi Kedai (Telegram + WhatsApp): TypeScript, grammY, Cloudflare tunnel webhook, LiteLLM, PostgreSQL.
Readme MIT
230 KiB
Languages
TypeScript 99.7%
Dockerfile 0.3%