diff --git a/README.md b/README.md index 9324e6c..c8059a6 100644 --- a/README.md +++ b/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 - **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 - **Queue Monitor**: Live view of waiting calls - **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 - **Callback System**: Offer callbacks instead of long holds - **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 - **Duplicate Prevention**: Ensures unique phone numbers per agent +- **Enhanced Notifications**: Discord and Slack integration for real-time alerts ## 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 - **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 ### 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**: - Go to **Twilio** → **Phone Numbers** - Verify numbers are synchronized - - Assign workflows to numbers + - Assign workflows to numbers (multiple numbers per workflow supported) ### Creating Workflows 1. **Navigate to** Twilio → Workflows 2. **Create New Workflow**: - Name your workflow - - Select phone number to assign + - Select phone numbers to assign (multiple selection supported) - Add steps using the builder 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 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 ### ElevenLabs Integration @@ -296,6 +336,7 @@ The plugin creates these tables: - `twp_call_queues` - Queue configurations (uses notification_number) - `twp_queued_calls` - Active calls in queues - `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_sms_log` - SMS message tracking - `twp_voicemails` - Recordings and transcriptions @@ -338,7 +379,15 @@ All webhooks are REST API endpoints under `/wp-json/twilio-webhook/v1/`: ## 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 - Fixed queue notification_number field naming - Enhanced voice selection persistence diff --git a/test-ajax-response.php b/test-ajax-response.php deleted file mode 100644 index 2cdbf02..0000000 --- a/test-ajax-response.php +++ /dev/null @@ -1,34 +0,0 @@ -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"; - } - } -} \ No newline at end of file diff --git a/test-capabilities.php b/test-capabilities.php deleted file mode 100644 index 11223ea..0000000 --- a/test-capabilities.php +++ /dev/null @@ -1,37 +0,0 @@ -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"; -} \ No newline at end of file diff --git a/test-sdk.php b/test-sdk.php deleted file mode 100644 index f94e3fe..0000000 --- a/test-sdk.php +++ /dev/null @@ -1,71 +0,0 @@ -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"; \ No newline at end of file diff --git a/twilio-wp-plugin.php b/twilio-wp-plugin.php index 7cde78e..454e084 100644 --- a/twilio-wp-plugin.php +++ b/twilio-wp-plugin.php @@ -1,10 +1,10 @@