Update README.md with comprehensive documentation and cleanup test files
- Added Discord & Slack notifications section with configuration guide - Documented multiple phone numbers per workflow feature - Updated version to 2.1.0 with full changelog - Enhanced configuration sections for new features - Added database structure documentation for twp_workflow_phones table - Removed obsolete test files (test-sdk.php, test-capabilities.php, test-ajax-response.php) - Updated plugin header with new version and repository URL 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
57
README.md
57
README.md
@@ -81,6 +81,14 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
|
|||||||
- **Command System**: Text commands to manage availability
|
- **Command System**: Text commands to manage availability
|
||||||
- **SMS Logging**: Complete history of all SMS interactions
|
- **SMS Logging**: Complete history of all SMS interactions
|
||||||
|
|
||||||
|
### 🔔 Discord & Slack Notifications
|
||||||
|
- **Real-time Alerts**: Instant notifications to Discord channels and Slack workspaces
|
||||||
|
- **Multiple Event Types**: Incoming calls, queue timeouts, and missed calls
|
||||||
|
- **Rich Formatting**: Structured messages with caller info, queue details, and timestamps
|
||||||
|
- **Webhook Integration**: Simple configuration with webhook URLs
|
||||||
|
- **Configurable Options**: Enable/disable specific notification types
|
||||||
|
- **Automatic Monitoring**: Background checks for queue timeout situations
|
||||||
|
|
||||||
### 📊 Real-time Dashboard
|
### 📊 Real-time Dashboard
|
||||||
- **Queue Monitor**: Live view of waiting calls
|
- **Queue Monitor**: Live view of waiting calls
|
||||||
- **Agent Status**: Track agent availability
|
- **Agent Status**: Track agent availability
|
||||||
@@ -92,9 +100,10 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
|
|||||||
- **Voicemail Transcription**: Automatic speech-to-text
|
- **Voicemail Transcription**: Automatic speech-to-text
|
||||||
- **Callback System**: Offer callbacks instead of long holds
|
- **Callback System**: Offer callbacks instead of long holds
|
||||||
- **Outbound Calling**: Click-to-call with proper caller ID
|
- **Outbound Calling**: Click-to-call with proper caller ID
|
||||||
- **Multiple Phone Numbers**: Support for multiple business lines
|
- **Multiple Phone Numbers**: Support for multiple business lines per workflow
|
||||||
- **Agent Phone Management**: Store and validate agent phone numbers
|
- **Agent Phone Management**: Store and validate agent phone numbers
|
||||||
- **Duplicate Prevention**: Ensures unique phone numbers per agent
|
- **Duplicate Prevention**: Ensures unique phone numbers per agent
|
||||||
|
- **Enhanced Notifications**: Discord and Slack integration for real-time alerts
|
||||||
|
|
||||||
## Recent Updates
|
## Recent Updates
|
||||||
|
|
||||||
@@ -119,6 +128,19 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
|
|||||||
- **Queue Selection**: Proper queue routing based on digit selection
|
- **Queue Selection**: Proper queue routing based on digit selection
|
||||||
- **Voice Selection**: Fixed voice dropdown persistence issues
|
- **Voice Selection**: Fixed voice dropdown persistence issues
|
||||||
|
|
||||||
|
### Multiple Phone Numbers Support
|
||||||
|
- **Workflow Enhancement**: Workflows can now be assigned to multiple phone numbers
|
||||||
|
- **Junction Table**: New `twp_workflow_phones` table for many-to-many relationships
|
||||||
|
- **Backward Compatibility**: Existing single-number workflows continue to work
|
||||||
|
- **Validation Fixes**: Proper validation for multiple phone number selections
|
||||||
|
|
||||||
|
### Discord & Slack Notifications
|
||||||
|
- **Real-time Integration**: Instant notifications to Discord channels and Slack workspaces
|
||||||
|
- **Event Monitoring**: Automated tracking of incoming calls, queue timeouts, and missed calls
|
||||||
|
- **Rich Message Format**: Structured notifications with caller details, queue info, and timestamps
|
||||||
|
- **Configurable Settings**: Toggle notification types and set custom webhook URLs
|
||||||
|
- **Background Processing**: Cron-based monitoring for queue timeout alerts
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
### Call Flow
|
### Call Flow
|
||||||
@@ -168,13 +190,13 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
|
|||||||
2. **In WordPress Admin**:
|
2. **In WordPress Admin**:
|
||||||
- Go to **Twilio** → **Phone Numbers**
|
- Go to **Twilio** → **Phone Numbers**
|
||||||
- Verify numbers are synchronized
|
- Verify numbers are synchronized
|
||||||
- Assign workflows to numbers
|
- Assign workflows to numbers (multiple numbers per workflow supported)
|
||||||
|
|
||||||
### Creating Workflows
|
### Creating Workflows
|
||||||
1. **Navigate to** Twilio → Workflows
|
1. **Navigate to** Twilio → Workflows
|
||||||
2. **Create New Workflow**:
|
2. **Create New Workflow**:
|
||||||
- Name your workflow
|
- Name your workflow
|
||||||
- Select phone number to assign
|
- Select phone numbers to assign (multiple selection supported)
|
||||||
- Add steps using the builder
|
- Add steps using the builder
|
||||||
|
|
||||||
3. **Configure Steps**:
|
3. **Configure Steps**:
|
||||||
@@ -218,6 +240,24 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
|
|||||||
4. **Configure Call Mode**: Browser or cell phone
|
4. **Configure Call Mode**: Browser or cell phone
|
||||||
5. **Train Agents** on SMS commands and browser phone
|
5. **Train Agents** on SMS commands and browser phone
|
||||||
|
|
||||||
|
### Discord & Slack Setup
|
||||||
|
1. **Discord Configuration**:
|
||||||
|
- Create a webhook URL in your Discord server settings
|
||||||
|
- Navigate to **Twilio** → **Settings** → **Notifications**
|
||||||
|
- Paste Discord webhook URL
|
||||||
|
- Enable desired notification types
|
||||||
|
|
||||||
|
2. **Slack Configuration**:
|
||||||
|
- Create a webhook URL in your Slack workspace
|
||||||
|
- Navigate to **Twilio** → **Settings** → **Notifications**
|
||||||
|
- Paste Slack webhook URL
|
||||||
|
- Configure notification preferences
|
||||||
|
|
||||||
|
3. **Notification Types**:
|
||||||
|
- **Incoming Calls**: Alert when calls enter queues
|
||||||
|
- **Queue Timeouts**: Alert when calls wait too long (configurable threshold)
|
||||||
|
- **Missed Calls**: Alert when calls are abandoned or timeout
|
||||||
|
|
||||||
## Voice Configuration
|
## Voice Configuration
|
||||||
|
|
||||||
### ElevenLabs Integration
|
### ElevenLabs Integration
|
||||||
@@ -296,6 +336,7 @@ The plugin creates these tables:
|
|||||||
- `twp_call_queues` - Queue configurations (uses notification_number)
|
- `twp_call_queues` - Queue configurations (uses notification_number)
|
||||||
- `twp_queued_calls` - Active calls in queues
|
- `twp_queued_calls` - Active calls in queues
|
||||||
- `twp_workflows` - Call flow definitions with voice persistence
|
- `twp_workflows` - Call flow definitions with voice persistence
|
||||||
|
- `twp_workflow_phones` - Junction table for multiple phone numbers per workflow
|
||||||
- `twp_call_log` - Complete call history
|
- `twp_call_log` - Complete call history
|
||||||
- `twp_sms_log` - SMS message tracking
|
- `twp_sms_log` - SMS message tracking
|
||||||
- `twp_voicemails` - Recordings and transcriptions
|
- `twp_voicemails` - Recordings and transcriptions
|
||||||
@@ -338,7 +379,15 @@ All webhooks are REST API endpoints under `/wp-json/twilio-webhook/v1/`:
|
|||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
### v2.0.0 (Current)
|
### v2.1.0 (Current)
|
||||||
|
- **Multiple Phone Numbers**: Workflows can now handle multiple phone numbers
|
||||||
|
- **Discord & Slack Integration**: Real-time notifications for call events
|
||||||
|
- **Enhanced Monitoring**: Automated queue timeout tracking and alerts
|
||||||
|
- **Notification System**: Configurable webhook-based notifications
|
||||||
|
- **Background Processing**: Cron jobs for timeout monitoring
|
||||||
|
- **Database Enhancements**: New junction table for phone number relationships
|
||||||
|
|
||||||
|
### v2.0.0
|
||||||
- Upgraded to Twilio Voice SDK v2 for browser phone
|
- Upgraded to Twilio Voice SDK v2 for browser phone
|
||||||
- Fixed queue notification_number field naming
|
- Fixed queue notification_number field naming
|
||||||
- Enhanced voice selection persistence
|
- Enhanced voice selection persistence
|
||||||
|
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Test what the AJAX method actually returns
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Load WordPress
|
|
||||||
$wp_load_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php';
|
|
||||||
require_once $wp_load_path;
|
|
||||||
|
|
||||||
// Load the plugin
|
|
||||||
require_once __DIR__ . '/includes/class-twp-twilio-api.php';
|
|
||||||
|
|
||||||
// Create API instance
|
|
||||||
$api = new TWP_Twilio_API();
|
|
||||||
|
|
||||||
// Get phone numbers
|
|
||||||
$response = $api->get_phone_numbers();
|
|
||||||
|
|
||||||
echo "API Response:\n";
|
|
||||||
echo "=============\n";
|
|
||||||
print_r($response);
|
|
||||||
|
|
||||||
if ($response['success'] && !empty($response['data']['incoming_phone_numbers'])) {
|
|
||||||
echo "\nFirst phone number data:\n";
|
|
||||||
echo "========================\n";
|
|
||||||
$first = $response['data']['incoming_phone_numbers'][0];
|
|
||||||
foreach ($first as $key => $value) {
|
|
||||||
if (is_array($value)) {
|
|
||||||
echo "$key: " . json_encode($value) . "\n";
|
|
||||||
} else {
|
|
||||||
echo "$key: $value\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Test script to check PhoneNumberCapabilities methods
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Load the autoloader
|
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
|
||||||
|
|
||||||
// Create a mock capabilities object to test available methods
|
|
||||||
echo "Testing PhoneNumberCapabilities methods:\n";
|
|
||||||
echo "========================================\n";
|
|
||||||
|
|
||||||
// We'll check what methods are available
|
|
||||||
$reflection = new ReflectionClass('Twilio\Base\PhoneNumberCapabilities');
|
|
||||||
$methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
|
|
||||||
|
|
||||||
echo "Public methods available:\n";
|
|
||||||
foreach ($methods as $method) {
|
|
||||||
if (!$method->isConstructor() && !$method->isDestructor()) {
|
|
||||||
echo "- " . $method->getName() . "()\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\nProperties:\n";
|
|
||||||
$properties = $reflection->getProperties();
|
|
||||||
foreach ($properties as $property) {
|
|
||||||
echo "- " . $property->getName() . " (" . ($property->isPublic() ? 'public' : ($property->isProtected() ? 'protected' : 'private')) . ")\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we can access via array notation
|
|
||||||
echo "\nTesting array access:\n";
|
|
||||||
try {
|
|
||||||
// This won't work, but let's see what happens
|
|
||||||
echo "ArrayAccess interface: " . (in_array('ArrayAccess', class_implements('Twilio\Base\PhoneNumberCapabilities')) ? 'YES' : 'NO') . "\n";
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo "Error: " . $e->getMessage() . "\n";
|
|
||||||
}
|
|
71
test-sdk.php
71
test-sdk.php
@@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Simple test script to verify Twilio SDK installation
|
|
||||||
* Run this from command line: php test-sdk.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo "Twilio SDK Installation Test\n";
|
|
||||||
echo "===========================\n\n";
|
|
||||||
|
|
||||||
// Check if autoloader exists
|
|
||||||
$autoloader = __DIR__ . '/vendor/autoload.php';
|
|
||||||
echo "1. Checking autoloader...\n";
|
|
||||||
echo " Path: $autoloader\n";
|
|
||||||
|
|
||||||
if (!file_exists($autoloader)) {
|
|
||||||
echo " ❌ FAIL: Autoloader not found\n";
|
|
||||||
echo " Please run: ./install-twilio-sdk.sh\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo " ✅ OK: Autoloader exists\n\n";
|
|
||||||
|
|
||||||
// Load autoloader
|
|
||||||
echo "2. Loading autoloader...\n";
|
|
||||||
require_once $autoloader;
|
|
||||||
echo " ✅ OK: Autoloader loaded\n\n";
|
|
||||||
|
|
||||||
// Check for Twilio classes
|
|
||||||
echo "3. Checking Twilio classes...\n";
|
|
||||||
|
|
||||||
$classes_to_check = [
|
|
||||||
'Twilio\Rest\Client',
|
|
||||||
'Twilio\TwiML\VoiceResponse',
|
|
||||||
'Twilio\Exceptions\TwilioException',
|
|
||||||
'Twilio\Security\RequestValidator'
|
|
||||||
];
|
|
||||||
|
|
||||||
$all_good = true;
|
|
||||||
foreach ($classes_to_check as $class) {
|
|
||||||
if (class_exists($class)) {
|
|
||||||
echo " ✅ OK: $class\n";
|
|
||||||
} else {
|
|
||||||
echo " ❌ FAIL: $class not found\n";
|
|
||||||
$all_good = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
|
|
||||||
if ($all_good) {
|
|
||||||
echo "🎉 SUCCESS: Twilio SDK is properly installed!\n";
|
|
||||||
echo "\nYou can now use the WordPress plugin.\n";
|
|
||||||
echo "Don't forget to configure your Twilio credentials in WordPress admin.\n";
|
|
||||||
} else {
|
|
||||||
echo "❌ FAILURE: SDK installation incomplete\n";
|
|
||||||
echo "\nPlease run: ./install-twilio-sdk.sh\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to create a simple TwiML response
|
|
||||||
echo "\n4. Testing TwiML generation...\n";
|
|
||||||
try {
|
|
||||||
$response = new \Twilio\TwiML\VoiceResponse();
|
|
||||||
$response->say('Hello from Twilio SDK test!');
|
|
||||||
echo " ✅ OK: TwiML generation works\n";
|
|
||||||
echo " Generated: " . substr(str_replace(["\n", "\r"], '', $response->asXML()), 0, 100) . "...\n";
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo " ❌ FAIL: TwiML generation failed: " . $e->getMessage() . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\nInstallation test complete!\n";
|
|
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Plugin Name: Twilio WP Plugin
|
* Plugin Name: Twilio WP Plugin
|
||||||
* Plugin URI: https://example.com/twilio-wp-plugin
|
* Plugin URI: https://repo.anhonesthost.net/wp-plugins/twilio-wp-plugin
|
||||||
* Description: WordPress plugin for Twilio integration with phone scheduling, call forwarding, queue management, and Eleven Labs TTS
|
* Description: WordPress plugin for Twilio integration with phone scheduling, call forwarding, queue management, and Eleven Labs TTS
|
||||||
* Version: 1.0.0
|
* Version: 2.1.0
|
||||||
* Author: Your Name
|
* Author: Josh Knapp
|
||||||
* License: GPL v2 or later
|
* License: GPL v2 or later
|
||||||
* Text Domain: twilio-wp-plugin
|
* Text Domain: twilio-wp-plugin
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user