Chat-Agent (PHP, JSON storage) - README

Files:
- config.php            : put your API keys and settings here
- webhook.php           : Facebook/WhatsApp webhook endpoint (verify + message receive)
- openai.php            : helper to call OpenAI (cURL)
- woo.php               : helper to call WooCommerce REST API (search)
- fb_send.php           : helper to send messages back to Facebook (cURL)
- data/messages.json    : messages and conversations (auto-created)
- data/settings.json    : settings (chatgpt_on true/false)
- admin/index.php       : admin dashboard - list conversations
- admin/chat.php        : view conversation and send manual reply
- admin/toggle.php      : toggle ChatGPT on/off
- .htaccess             : restrict access to data folder (recommended)

Installation (short):
1. Upload entire folder to cPanel public_html/chat-agent/
2. Edit config.php with keys (OPENAI_KEY, FB_PAGE_TOKEN, WC_BASE, WC_KEY, WC_SECRET)
3. Make sure data/ is writable by PHP (chmod 755 or 775)
4. Set Facebook webhook URL to https://yourdomain.com/chat-agent/webhook.php
5. Visit https://yourdomain.com/chat-agent/admin/index.php

IMPORTANT:
- This is a starter script. Validate and secure endpoints before production use.
- Keep your API keys private.
