Skip to content

SwapnilSoni1999/amul-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯› Amul Stock Notification Bot

Telegram GitHub stars License: MIT Endpoint Badge

A powerful Telegram bot that helps you track the availability of Amul's protein-rich products including protein shakes, lassi, whey protein, paneer, and more. Get real-time notifications when your favorite products are back in stock in your local area!


✨ Features

  • πŸ” Browse Products: View all Amul protein products with real-time availability
  • πŸ“ Location-Based: Set your pincode to get local stock updates
  • οΏ½ Smart Notifications: Get notified instantly when tracked products are back in stock
  • οΏ½ Stock Tracking: Monitor inventory levels and stock changes
  • ⚑ Real-Time Updates: Automated checks every 3 minutes
  • πŸ“± User-Friendly: Simple Telegram interface with inline buttons
  • 🎯 Selective Tracking: Track only the products you care about
  • πŸ“ˆ Analytics: View bot statistics and usage data

πŸš€ Quick Start

For Users

  1. Start the Bot: Click here to open @AmulOSSBot
  2. Set Your Location: Use /setpincode YOUR_PINCODE to set your area
  3. Browse Products: Use /products to see all available items
  4. Track Items: Click the "Track" button next to products you want to monitor
  5. Get Notified: Receive instant notifications when items are back in stock

Example Usage

/start                    # Welcome message and setup
/setpincode 400001        # Set your pincode (Mumbai in this example)
/products                 # Browse all protein products
/tracked                  # View your tracked items
/support                  # Get help and contact info

πŸ€– Bot Commands

Command Description Example
/start Initialize bot and show welcome message /start
/setpincode Set your delivery pincode /setpincode 400001
/products List all available Amul protein products /products
/tracked Show products you're currently tracking /tracked
/pincode View your current pincode setting /pincode
/support Get support and contact information /support

Admin Commands (Bot Owner Only)

Command Description
/broadcast Send message to all bot users
/stats View bot usage statistics
/sessions View active Amul API sessions

πŸ—οΈ Tech Stack

  • Runtime: Node.js 18+ with TypeScript
  • Bot Framework: Telegraf.js - Modern Telegram bot framework
  • Database: MongoDB with Mongoose ODM
  • HTTP Client: Axios for API requests
  • Caching: Redis for performance optimization
  • Scheduling: node-cron for automated stock checks
  • Process Management: PM2 for production deployment
  • Code Quality: ESLint + Prettier for code formatting

πŸ› οΈ Development Setup

Prerequisites

  • Node.js 18+ and pnpm
  • MongoDB database
  • Redis server (optional, for caching)
  • Telegram Bot Token (from @BotFather)

Installation

# Clone the repository
git clone https://github.com/SwapnilSoni1999/amul-notify.git
cd amul-notify

# Install dependencies
pnpm install

# Setup environment variables
cp .env.example .env.dev
# Edit .env.dev with your configuration

# Run in development mode
pnpm run dev

# Or build and run in production
pnpm run build
pnpm start

Environment Variables

Create .env.dev for development or .env.prod for production:

# Bot Configuration
BOT_TOKEN=your_telegram_bot_token
BOT_USERNAME=YourBotUsername

# Database
MONGODB_URI=mongodb://localhost:27017/amul-notify

# Redis (Optional)
REDIS_URL=redis://localhost:6379

# Bot Settings
TRACKER_ENABLED=true
LOG_CHANNEL_ID=your_log_channel_id
ADMIN_USER_IDS=123456789,987654321

# Environment
NODE_ENV=development

Available Scripts

pnpm run dev         # Start development server with hot reload
pnpm run build       # Build the project
pnpm start           # Start production server
pnpm run lint        # Run ESLint
pnpm run prettier    # Format code with Prettier
pnpm run seed:dev    # Seed database with admin users (development)
pnpm run seed:prod   # Seed database with admin users (production)

πŸš€ Deployment

Using PM2

# Install PM2 globally
npm install -g pm2

# Build the project
pnpm run build

# Start with PM2
pm2 start dist/server.js --name "amul-notify"

# Monitor
pm2 status
pm2 logs amul-notify

Using Docker (Recommended)

# Build Docker image
docker build -t amul-notify .

# Run container
docker run -d \
  --name amul-notify \
  --env-file .env.prod \
  -p 3000:3000 \
  amul-notify

οΏ½ Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style and conventions
  • Add tests for new features
  • Update documentation as needed
  • Use conventional commit messages
  • Ensure all emojis use the centralized emoji.util.ts

πŸ“Š Features in Detail

Smart Stock Tracking

  • Monitors product availability every 5 minutes
  • Tracks inventory changes across different locations
  • Sends instant notifications when products come back in stock

Location-Based Filtering

  • Uses Indian pincode system for location detection
  • Shows only products available in your delivery area
  • Supports multiple substores and distribution centers

User Management

  • Automatic user registration on first interaction
  • Tracks user preferences and pincode settings
  • Rate limiting to prevent spam

Admin Features

  • Broadcast messages to all users
  • View comprehensive bot statistics
  • Monitor API sessions and performance

πŸ›‘οΈ Privacy & Disclaimer

  • Privacy: This bot only stores your Telegram user ID and chosen pincode for functionality
  • Data Source: All product data is fetched from the official Amul store (shop.amul.com)
  • Unofficial: This project is not affiliated with or endorsed by Amul
  • Purpose: Educational and utility project to help users track product availability

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


οΏ½ Acknowledgments

  • Amul for providing the product data through their public API
  • Telegraf.js for the excellent Telegram bot framework
  • All contributors and users who help improve this bot

Made with ❀️ by Swapnil Soni

πŸ€– Try the Bot β€’ ⭐ Star on GitHub β€’ πŸ“ž Contact

About

🍫 Fastest and most reliable Amul stock checker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages