messente / messente-api-php
[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any un
Installs: 93 752
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 6
Forks: 7
Open Issues: 0
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2 || ^7.0
- guzzlehttp/psr7: ^1.8
README
- Messente API version: 2.0.0
- PHP artifact version: 3.2.0
Messente is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds tools to help organizations connect their services to people anywhere in the world.
Installation
Install Messente API library with composer require messente/messente-api-php
.
Features
Messente API has the following features:
- Omnichannel (external docs),
- Phonebook (external docs).
Messente API Library provides the operations described below to access the features.
BlacklistApi
- Adds a phone number to the blacklist
addToBlacklist
- Deletes a phone number from the blacklist
deleteFromBlacklist
- Returns all blacklisted phone numbers
fetchBlacklist
- Checks if a phone number is blacklisted
isBlacklisted
BulkMessagingApi
- Sends a bulk Omnimessage
sendBulkOmnimessage
ContactsApi
- Adds a contact to a group
addContactToGroup
- Creates a new contact
createContact
- Deletes a contact
deleteContact
- Lists a contact
fetchContact
- Lists groups of a contact
fetchContactGroups
- Returns all contacts
fetchContacts
- Removes a contact from a group
removeContactFromGroup
- Updates a contact
updateContact
DeliveryReportApi
- Retrieves the delivery report for the Omnimessage
retrieveDeliveryReport
GroupsApi
- Creates a new group with the provided name
createGroup
- Deletes a group
deleteGroup
- Lists a group
fetchGroup
- Returns all groups
fetchGroups
- Updates a group with the provided name
updateGroup
NumberLookupApi
- Requests info about phone numbers
fetchInfo
OmnimessageApi
- Cancels a scheduled Omnimessage
cancelScheduledMessage
- Sends an Omnimessage
sendOmnimessage
StatisticsApi
- Requests statistics reports for each country
createStatisticsReport
Auth
Type: HTTP basic authentication
Read the external getting-started article which explains API keys and Sender ID logic.
Getting started: sending an omnimessage
<?php require_once(__DIR__ . '/../vendor/autoload.php'); use Messente\Api\Api\OmnimessageApi; use Messente\Api\Model\Omnimessage; use Messente\Api\Configuration; use Messente\Api\Model\WhatsApp; use Messente\Api\Model\WhatsAppParameter; use Messente\Api\Model\WhatsAppComponent; use Messente\Api\Model\WhatsAppLanguage; use Messente\Api\Model\WhatsAppTemplate; // 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"] ); $whatsAppParameters = [new WhatsAppParameter(['type' => 'text', 'text' => 'hello whatsapp'])]; $whatsAppComponent = new WhatsAppComponent(['type' => 'body', 'parameters' => $whatsAppParameters]); $whatsAppLanguage = new WhatsAppLanguage(['code' => '<language_code>']); $whatsAppTemplate = new WhatsAppTemplate( [ 'name'=> '<template_name>', 'language'=> $whatsAppLanguage, 'components' => [$whatsAppComponent] ] ); $whatsapp = new WhatsApp( [ 'sender' => '<sender name (optional)>', 'template' => $whatsAppTemplate, ] ); $omnimessage->setMessages([$whatsapp, $viber, $sms]); try { $result = $apiInstance->sendOmnimessage($omnimessage); print_r($result); } catch (Exception $e) { echo 'Exception when calling sendOmnimessage: ', $e->getMessage(), PHP_EOL; } ?>