# vBot Customer Webhook Handler This package provides a simple webhook handler for vBot customers to receive and process call analysis results on their own servers. ## Features - Secure webhook endpoint with API key validation - Automatic call record storage in MySQL database - Configurable webhook secret for additional security - Easy integration with LAMP stack - Example implementation included ## Requirements - PHP 7.4 or higher - MySQL 5.7 or higher - Apache/Nginx web server - mod_rewrite enabled (for Apache) ## Installation 1. Copy the contents of this package to your web server directory: ```bash cp -r customer_webhook/* /var/www/html/vbot-webhook/ ``` 2. Create the MySQL database and table: ```sql CREATE DATABASE vbot_calls; USE vbot_calls; CREATE TABLE call_records ( id VARCHAR(36) PRIMARY KEY, customer_id INT NOT NULL, caller_number VARCHAR(20) NOT NULL, called_number VARCHAR(20) NOT NULL, transcription TEXT, summary TEXT, sentiment VARCHAR(50), keywords TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); ``` 3. Configure the webhook handler: - Copy `config/config.example.php` to `config/config.php` - Update the database credentials and webhook secret 4. Set up Apache/Nginx: - Ensure the webhook directory is accessible - Configure URL rewriting (see examples) ## Configuration Edit `config/config.php` to set your: - Database credentials - Webhook secret (for additional security) - API key (provided by vBot) ## Usage 1. Your webhook URL will be: `https://your-domain.com/vbot-webhook/webhook.php` 2. The webhook will receive POST requests with call analysis data in JSON format: ```json { "call_id": "uuid", "caller_number": "+1234567890", "called_number": "+0987654321", "transcription": "Call transcript...", "summary": "Call summary...", "sentiment": "positive", "keywords": "keyword1, keyword2", "timestamp": "2024-03-14T12:00:00Z", "customer_id": 123 } ``` 3. The handler will: - Validate the API key - Store the call record in your database - Return a success response ## Security - All requests must include the API key in the `X-API-Key` header - Optional webhook secret for additional security - Input validation and sanitization - SQL injection prevention ## Examples See the `examples` directory for: - Apache configuration - Nginx configuration - Custom processing example ## Support For support, contact vBot support team or refer to the documentation.