Skip to content

Repository files navigation

Chatbot Simulation

A storefront chatbot built for the Introduction to Computing (KU1102-19) Project at STEI ITB — Tugas Besar Pengenalan Komputasi 1: Algoritma dan Pemrograman.

The assignment is an exercise in applying computational thinking techniques — decomposition, abstraction, pattern recognition, and algorithm design — to a chatbot application. The shop is decomposed into independent commands (browse, stock, cart, checkout), its catalog and settings are abstracted into data rather than code, the repeating shape of every command is factored into shared helpers, and each flow is expressed as an explicit algorithm over a shared database.

It ships as four surfaces over one database: a Telegram bot, an analytics dashboard, a command-line interface, and a key-guarded JSON API.

Landing page, dashboard, and Telegram bot walkthrough Command-line interface walkthrough
Web & Telegram Command Line

Screenshots

Landing page hero Feature cards for the four surfaces
How it works section and footer Analytics dashboard with income, sales, and weekly revenue charts
Telegram bot greeting and stock listing Browsing the catalog and adding items to the cart
Cart summary, payment methods, and order confirmation Checkout notifications delivered to the admin chat

Command Line Interface

python cli.py

Telegram Bot & Analytics Dashboard

Installation

Dependencies are managed with PDM (pyproject.toml + pdm.lock), on Python 3.13.

git clone https://github.com/faizath/chatbot.git
cd chatbot
pdm install
pdm run python manage.py migrate
pdm run python manage.py runserver

Configuration

Env var Default Notes
DJANGO_SECRET_KEY (none) Required whenever DJANGO_DEBUG is off. With debug on, a random key is generated per start, so sessions reset on restart.
DJANGO_DEBUG false Accepts 1/true/yes/on. Never enable it in production.

Generate a secret key with:

pdm run python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Set both in the server's environment. With debug off, static files are served by whitenoise from a manifest, so collectstatic must run before the server starts — runserver.sh already does this.

The Telegram bot polls in its own process, so start it alongside the web server:

pdm run python manage.py runbot

It needs a ChatbotUser row with username='admin' and a telegram_token set; without one it exits with an error.

About

Telegram storefront chatbot with a live analytics dashboard, a CLI, and a key-guarded JSON API over one Django database. 🎓 Introduction to Computing (KU1102-19) Project at STEI ITB

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Contributors

Languages