PHP code example of omdaa / omdaa-php
1. Go to this page and download the library: Download omdaa/omdaa-php 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/ */
omdaa / omdaa-php example snippets
mdaa\Api\OmdaaClient;
use Omdaa\Api\OmdaaException;
$client = new OmdaaClient('your-api-key');
// Optional: new OmdaaClient('your-api-key', 'https://omdaa.com/api/v1');
try {
// List sessions
$sessions = $client->sessions()->list();
// Send a text message
$result = $client->messages()->sendText([
'sessionId' => 'default',
'to' => '201234567890',
'message' => 'Hello from Omdaa PHP!',
]);
// Webhooks
$client->webhooks()->set(['url' => 'https://yoursite.com/webhook', 'enabled' => true]);
} catch (OmdaaException $e) {
echo $e->getStatusCode() . ': ' . $e->getMessage();
}
bash
composer