File size: 2,696 Bytes
7d72bcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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.