The MessageMedia Conversations API allows users to communicate by sending and receiving messages via OTT messaging services. This feature is disabled by default. To enable it, you don't need to make any changes to your application, just an account configuration change by MessageMedia's support team ([email protected]).
Run the Composer command to install the latest stable version of the Messages SDK:
composer require messagemedia/conversations-sdk
It's easy to get started. Simply enter the API Key and secret you obtained from the MessageMedia Developers Portal into the code snippet below.
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$provisioning = $client->getConfiguration();
$bodyValue = "{ \"name\": \"Rainbow Serpent Festival\", \"callback_url\": \"https://callback.url.com\"}";
$body = MessageMediaConversationsLib\APIHelper::deserialize($bodyValue);
$configuration->createConfigureAccount($body);
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$facebook = $client->getFacebook();
$result = $facebook->getFacebookAuthorisationURL();
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$facebook = $client->getFacebook();
$result = $facebook->getFacebookPages();
You can get the facebookPageId by looking at the response of the Get Facebook pages example.
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$facebook = $client->getFacebook();
$facebookPageId = 'facebookPageId';
$facebook->createIntegrateFacebookPage($facebookPageId);
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$appUsers = $client->getAppUsers();
$result = $appUsers->getAppUsers();
You can get the appUserId from the response of the Get users example.
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$appUsers = $client->getAppUsers();
$appUserId = 'appUserId';
$result = $appUsers->getAppUserMessages($appUserId);
You can get the appUserId from the response of the Get users example.
require_once('vendor/autoload.php');
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication
$client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword);
$appUsers = $client->getAppUsers();
$appUserId = 'appUserId';
$body = new BaseMessageDto({"key":"value"});
$appUsers->createSendMessage($appUserId, $body);
Check out the full API documentation for more detailed information.
Please contact developer support at [email protected] or check out the developer portal at developers.messagemedia.com
Apache License. See the LICENSE file.