PHP code example of apimaticsupport / conversationsapi
1. Go to this page and download the library: Download apimaticsupport/conversationsapi library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
apimaticsupport / conversationsapi example snippets
$publicId = '{{PublicId}}'; // PublicId from application's API keys tab.
$secret = '{{Secret}}'; // Secret from application's API keys tab.
$client = new ConversationsAPILib\ConversationsAPIClient($publicId, $secret);
$outboundMessages = $client->getOutboundMessages();
function sendMessage($body)
$body = new GenericMessageStructure();
$result = $outboundMessages->sendMessage($body);
$whatsapp_OutboundTemplateMessage = $client->getWhatsappOutboundTemplateMessage();
function sendTemplateTextMessage(
$body,
$contentType)
$body = new GenericMessageStructureWithTemplate();
$contentType = 'application/json';
$result = $whatsapp_OutboundTemplateMessage->sendTemplateTextMessage($body, $contentType);
$whatsapp_OutboundSessionMessage = $client->getWhatsappOutboundSessionMessage();
function sendTextSessionMessage($body)
$body = new GenericMessageStructureWithText();
$result = $whatsapp_OutboundSessionMessage->sendTextSessionMessage($body);
function sendImageSessionMessage($body)
$body = new GenericMessageStructureWithImage();
$result = $whatsapp_OutboundSessionMessage->sendImageSessionMessage($body);
function sendVideoSessionMessage($body)
$body = new GenericMessageStructureWithVideo();
$result = $whatsapp_OutboundSessionMessage->sendVideoSessionMessage($body);
function sendAudioSessionMessage($body)
$body = new GenericMessageStructureWithAudio();
$result = $whatsapp_OutboundSessionMessage->sendAudioSessionMessage($body);
function sendFileSessionMessage($body)
$body = new GenericMessageStructureWithFile();
$result = $whatsapp_OutboundSessionMessage->sendFileSessionMessage($body);
function sendContactsSessionMessage($body)
$body = new GenericMessageStructureWithContacts();
$result = $whatsapp_OutboundSessionMessage->sendContactsSessionMessage($body);
function sendLocationSessionMessage($body)
$body = new GenericMessageStructureWithLocation();
$result = $whatsapp_OutboundSessionMessage->sendLocationSessionMessage($body);
function sendListMessage($body)
$body = new GenericMessageStructureWithListMessage();
$result = $whatsapp_OutboundSessionMessage->sendListMessage($body);
function sendReplyButtonMessage($body)
$body = new GenericMessageStructureWithReplyButton();
$result = $whatsapp_OutboundSessionMessage->sendReplyButtonMessage($body);
function sendProductMessage($body)
$body = new GenericMessageStructureWithProduct();
$result = $whatsapp_OutboundSessionMessage->sendProductMessage($body);
function sendProductListMessage($body)
$body = new GenericMessageStructureWithProductList();
$result = $whatsapp_OutboundSessionMessage->sendProductListMessage($body);
autoload.php