Skip to content

echandsome/shop-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shop Telegram Bot

A full-featured e-commerce Telegram bot built with Node.js. Browse categories and products, manage your cart, checkout with discount codes, leave reviews, and get support—all inside Telegram.

Features

  • Catalog — Browse categories and product details
  • Shopping cart — Add/remove items, view cart
  • Checkout — Discount codes, shipping options, payment flow
  • User profile — Account and order history
  • Reviews — Rate products, write comments, paginated review list
  • Support — Live support chat with clear/close actions
  • PGP key — Display shop PGP key for secure contact
  • Menu — Inline keyboards and reply keyboard for quick navigation

Tech stack

  • Node.js — Runtime
  • node-telegram-bot-api — Telegram Bot API (long polling)
  • MongoDB — Database (via Mongoose)
  • Winston — Logging
  • dotenv — Environment configuration

Prerequisites

Setup

  1. Clone the repo

    git clone https://github.com/echandsome/shop-telegram-bot.git
    cd shop-telegram-bot
  2. Install dependencies

    npm install
  3. Configure environment

    Create a .env file in the project root:

    TELEGRAM_BOT_TOKEN=your_bot_token_here

    Optional: override the database URL in config/config.js (default: mongodb://localhost:27017/telegramBot).

  4. Start MongoDB (if local)

    Ensure MongoDB is running on localhost:27017 or update the connection string in config/config.js.

  5. Run the bot

    npm start

    The bot uses nodemon for development (auto-restart on file changes). For production, run with node index.js or use a process manager like PM2.

Project structure

├── bot/
│   ├── commands/     # Command handlers (start, cart, checkout, etc.)
│   ├── handlers.js   # Route commands and callback queries
│   └── keyboards.js  # Inline and reply keyboards
├── config/
│   └── config.js     # App config (env, DB URL, logs)
├── data/             # Mongoose models and DB connection
├── services/         # Business logic (user, cart, order, review, etc.)
├── utils/            # Logging and helpers
├── index.js          # Entry point
└── package.json

Bot commands

Command Description
/start Welcome and main menu
/products Browse categories/products
/cart View or manage cart
/profile User profile
/reviews Product reviews
/support Support chat
/pgpkey Shop PGP key

License

ISC

About

Full-featured e-commerce Telegram bot: browse products, cart, checkout with discounts, reviews, support chat & PGP. Node.js + MongoDB + node-telegram-bot-api.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors