This is the PHP library for Messente Omnichannel API
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/messente/messente-omnichannel-php.git"
}
],
"require": {
"messente/messente-omnichannel-php": "*@master"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once(__DIR__ . '/vendor/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/../vendor/autoload.php');
use \Messente\Omnichannel\Api\OmnimessageApi;
use \Messente\Omnichannel\Configuration;
use \Messente\Omnichannel\Model\Omnimessage;
use \Messente\Omnichannel\Model\Viber;
use \Messente\Omnichannel\Model\SMS;
use \Messente\Omnichannel\Model\WhatsApp;
use \Messente\Omnichannel\Model\WhatsAppText;
// Configure HTTP basic authorization: basicAuth
$config = Configuration::getDefaultConfiguration()
->setUsername('<MESSENTE_API_USERNAME>')
->setPassword('<MESSENTE_API_PASSWORD>');
$apiInstance = new OmnimessageApi(
new GuzzleHttp\Client(),
$config
);
$omnimessage = new Omnimessage([
"to" => "<phone number in e.164 format>"
]);
$viber = new Viber(
["text" => "Hello Viber!", "sender" => "MyViberSender"]
);
$sms = new SMS(
["text" => "Hello SMS!", "sender" => "MySmsSender"]
);
$whatsAppText = new WhatsAppText(["body" => "Hello WhatsApp!"]);
$whatsapp = new WhatsApp(
['text' => $whatsAppText, "sender" => "MyWhatsAppSender"]
);
$omnimessage->setMessages([$whatsapp, $viber, $sms]);
try {
$result = $apiInstance->sendOmnimessage($omnimessage);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling OmnimessageApi->sendOmnimessage: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.messente.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
DeliveryReportApi | retrieveDeliveryReport | GET /omnimessage/{omnimessage_id}/status | Retrieves the delivery report for the Omnimessage |
OmnimessageApi | cancelScheduledMessage | DELETE /omnimessage/{omnimessage_id} | Cancels a scheduled Omnimessage |
OmnimessageApi | sendOmnimessage | POST /omnimessage | Sends an Omnimessage |
- Channel
- DeliveryReportResponse
- DeliveryResult
- Err
- ErrorItem
- ErrorResponse
- MessageResult
- OmniMessageCreateSuccessResponse
- Omnimessage
- ResponseErrorCode
- ResponseErrorTitle
- SMS
- Status
- TextStore
- Viber
- WhatsAppAudio
- WhatsAppDocument
- WhatsAppImage
- WhatsAppText
- Type: HTTP basic authentication