messente / messente-omnichannel-php
Messente's API which allows sending messages via various channels with fallback options.
Installs: 2 650
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 7
Forks: 1
Open Issues: 1
Requires
- php: >=5.6
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2021-01-28 18:35:23 UTC
README
This is the PHP library for Messente Omnichannel API
Requirements
PHP 5.5 and later
Installation & Usage
Composer
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
Manual Installation
Download the files and include autoload.php
:
require_once(__DIR__ . '/vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
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; }
Documentation for API Endpoints
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 |
Documentation For Models
- Channel
- DeliveryReportResponse
- DeliveryResult
- Err
- ErrorItem
- ErrorResponse
- MessageResult
- OmniMessageCreateSuccessResponse
- Omnimessage
- ResponseErrorCode
- ResponseErrorTitle
- SMS
- Status
- TextStore
- Viber
- WhatsAppAudio
- WhatsAppDocument
- WhatsAppImage
- WhatsAppText
Documentation For Authorization
basicAuth
- Type: HTTP basic authentication