Skip to content
nullerfanPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Okala Price Radar

A price monitoring system for Okala grocery stores that tracks price changes and sends notifications via Bale Messenger bot.

Features

  • Real-time price monitoring for multiple Okala stores
  • Automatic price comparison (before/after)
  • Bale Messenger bot notifications for:
    • Price changes
    • Stock availability changes
    • Discount changes
  • Admin panel for configuration and monitoring
  • Smart caching system (updates every 10 minutes)
  • Message queue for rate limiting

Requirements

  • PHP 8.0+
  • MySQL 8.0+
  • cURL extension
  • Bale Bot account (Iranian messenger platform)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/okala-price-radar.git
    cd okala-price-radar
  2. Copy .env.example to .env and configure:

    cp .env.example .env
  3. Edit .env with your credentials:

    • BALE_BOT_TOKEN: Your Bale bot token
    • BALE_CHANNEL_ID: Your channel ID
    • BALE_ADMIN_ID: Your admin user ID
    • DB_*: Database credentials
  4. Run the installer:

    php scripts/install.php
  5. Setup the cron job or run master script:

    # Option 1: Run master script (recommended)
    php src/master_cron.php
    
    # Option 2: Setup cron jobs
    # Add to crontab:
    */10 * * * * php /path/to/src/cron.php
    * * * * * php /path/to/src/send_messages.php

Project Structure

okala-price-radar/
├── src/                    # Main source files
│   ├── config.php         # Configuration (reads from .env)
│   ├── cron.php           # Price crawling engine
│   ├── master_cron.php    # Cron orchestrator
│   ├── api.php            # Admin panel backend
│   ├── index.php          # Admin panel frontend
│   ├── webhook.php        # Bale bot webhook
│   ├── send_messages.php  # Message sender
│   └── send_messages_loop.php
├── scripts/                # Utility scripts
│   ├── install.php        # Database installer
│   └── cleanup_cache.php  # Cache cleanup
├── database/
│   └── schema.sql         # Database schema
├── cache/                  # Runtime cache (gitignored)
├── docs/
│   └── setup.md           # Detailed setup guide
├── .env.example           # Environment template
├── .gitignore             # Git ignore rules
└── README.md              # This file

Configuration

Environment Variables

Variable Description
BALE_BOT_TOKEN Bale bot API token
BALE_CHANNEL_ID Channel ID for notifications
BALE_ADMIN_ID Admin user ID
DB_HOST MySQL host (default: localhost)
DB_NAME Database name
DB_USER Database username
DB_PASS Database password

Adding Stores

  1. Login to admin panel via Bale bot
  2. Add store with Okala API URL format:
    https://apigateway.okala.com/api/Search/v1/Product/Search?StoreIds=STORE_ID
    

Usage

Admin Panel

Access the admin panel through Bale bot:

  1. Send /start to your bot
  2. Click "Open Admin Panel"
  3. Configure stores and notification settings

Manual Check

php src/cron.php?manual=1

Monitor Logs

tail -f debug.log

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages