code push
This commit is contained in:
37
CLAUDE.md
37
CLAUDE.md
@@ -18,7 +18,7 @@ This is a comprehensive WordPress plugin for Twilio voice and SMS integration, f
|
||||
### Core Classes (`includes/` directory)
|
||||
- **TWP_Core**: Main plugin initialization and hook registration
|
||||
- **TWP_Activator**: Database table creation and plugin activation
|
||||
- **TWP_Twilio_API**: Twilio REST API wrapper (custom implementation)
|
||||
- **TWP_Twilio_API**: Official Twilio PHP SDK wrapper (requires SDK v8.7.0)
|
||||
- **TWP_Webhooks**: Handles all Twilio webhook endpoints
|
||||
- **TWP_Scheduler**: Business hours and schedule management
|
||||
- **TWP_Workflow**: Call flow processing and TwiML generation
|
||||
@@ -131,25 +131,28 @@ Agent phone numbers stored as user meta:
|
||||
|
||||
## Twilio Integration
|
||||
|
||||
### Current Implementation
|
||||
- **Custom API Wrapper**: `TWP_Twilio_API` class using `wp_remote_post()`
|
||||
- **TwiML Generation**: String-based XML construction
|
||||
- **Response Handling**: Custom parsing of Twilio responses
|
||||
### Current Implementation (SDK-Only)
|
||||
- **Official Twilio SDK**: Uses `twilio/sdk` v8.7.0 for all operations
|
||||
- **TwiML Generation**: Uses `\Twilio\TwiML\VoiceResponse` classes
|
||||
- **Response Handling**: Native Twilio SDK response objects
|
||||
- **Error Handling**: Proper `\Twilio\Exceptions\TwilioException` handling
|
||||
|
||||
### Recommended Migration to Twilio PHP SDK
|
||||
**URL**: https://www.twilio.com/docs/libraries/reference/twilio-php/
|
||||
### Installation Requirements
|
||||
**IMPORTANT**: The Twilio PHP SDK v8.7.0 is **REQUIRED** for this plugin to function.
|
||||
|
||||
**Benefits**:
|
||||
- Official SDK with better error handling
|
||||
- Built-in TwiML generation classes
|
||||
- Automatic retries and rate limiting
|
||||
- Type safety and IDE support
|
||||
**Installation Methods**:
|
||||
1. **Script Installation** (Recommended):
|
||||
```bash
|
||||
chmod +x install-twilio-sdk.sh
|
||||
./install-twilio-sdk.sh
|
||||
```
|
||||
|
||||
**Migration Strategy**:
|
||||
1. Install via Composer: `composer require twilio/sdk`
|
||||
2. Replace `TWP_Twilio_API` methods with SDK calls
|
||||
3. Update TwiML generation to use SDK classes
|
||||
4. Maintain existing method signatures for compatibility
|
||||
2. **Composer Installation**:
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
|
||||
**PHP Requirements**: PHP 8.0+ required for SDK compatibility
|
||||
|
||||
### API Response Structure
|
||||
Current Twilio API responses follow this pattern:
|
||||
|
Reference in New Issue
Block a user