No description, website, or topics provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
examples
lib
test
.gitignore
README.md
autoload.php
composer.json
config.json
phpunit.xml.dist

README.md

messente-omnichannel-php

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

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

messente@messente.com