PHP code example of blamodex / laravel-quo

1. Go to this page and download the library: Download blamodex/laravel-quo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

blamodex / laravel-quo example snippets


return [
    'api_key' => env('QUO_API_KEY', ''),
    'base_url' => env('QUO_BASE_URL', 'https://api.openphone.com'),
];

use Blamodex\Quo\Services\QuoService;

$quo = app(QuoService::class);

// List calls for a phone number
$result = $quo->calls()->list('PN123', ['+15551234567'], [
    'maxResults' => 25,
    'createdAfter' => '2025-01-01T00:00:00Z',
]);
// $result['calls'] => array of CallData
// $result['totalItems'] => int
// $result['nextPageToken'] => string|null

// Get a single call
$call = $quo->calls()->find('AC123');

// Get recordings for a call
$recordings = $quo->calls()->getRecordings('AC123');

// Get call summary
$summary = $quo->calls()->getSummary('AC123');

// Get call transcript
$transcript = $quo->calls()->getTranscript('AC123');

// Get voicemail for a call
$voicemail = $quo->calls()->getVoicemail('AC123');

// List contacts
$result = $quo->contacts()->list(['maxResults' => 50]);

// Get a contact
$contact = $quo->contacts()->find('CT123');

// Create a contact
$contact = $quo->contacts()->create([
    'firstName' => 'John',
    'lastName' => 'Doe',
    'phoneNumbers' => [['name' => 'Mobile', 'value' => '+15551234567']],
]);

// Update a contact
$contact = $quo->contacts()->update('CT123', [
    'defaultFields' => ['firstName' => 'Jane'],
]);

// Delete a contact
$quo->contacts()->delete('CT123');

// Get custom fields
$fields = $quo->contacts()->getCustomFields();

// List conversations
$result = $quo->conversations()->list([
    'phoneNumbers' => ['+15551234567'],
    'excludeInactive' => true,
    'maxResults' => 25,
]);

// List messages
$result = $quo->messages()->list('PN123', ['+15551234567']);

// Get a message
$message = $quo->messages()->find('MSG123');

// Send a message
$message = $quo->messages()->send(
    'Hello!',
    '+15551234567',
    ['+15559876543'],
);

// List all phone numbers
$numbers = $quo->phoneNumbers()->list();

// List phone numbers for a user
$numbers = $quo->phoneNumbers()->list('US123');

// Get a phone number
$number = $quo->phoneNumbers()->find('PN123');

// List users
$result = $quo->users()->list(['maxResults' => 50]);

// Get a user
$user = $quo->users()->find('US123');

// List webhooks
$webhooks = $quo->webhooks()->list();

// Get a webhook
$webhook = $quo->webhooks()->find('WH123');

// Create webhooks for different resources
$webhook = $quo->webhooks()->createForCalls('https://example.com/hook', ['call.completed']);
$webhook = $quo->webhooks()->createForMessages('https://example.com/hook', ['message.received']);
$webhook = $quo->webhooks()->createForCallSummaries('https://example.com/hook', ['call.summary.completed']);
$webhook = $quo->webhooks()->createForCallTranscripts('https://example.com/hook', ['call.transcript.completed']);

// Delete a webhook
$quo->webhooks()->delete('WH123');

use Blamodex\Quo\Exceptions\QuoApiException;

try {
    $call = $quo->calls()->find('AC_invalid');
} catch (QuoApiException $e) {
    $e->getMessage();   // "Call not found"
    $e->statusCode;     // 404
    $e->errorCode;      // "0900404"
    $e->docs;           // "https://docs.openphone.com/..."
    $e->getPrevious();  // Original exception (for connection failures)
}
bash
php artisan vendor:publish --tag=blamodex-quo-config