PHP code example of quick-communication / php-sdk
1. Go to this page and download the library: Download quick-communication/php-sdk 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/ */
quick-communication / php-sdk example snippets
uickCommunication\Client;
$client = new Client([
'base_url' => 'https://ok-go.in',
'app_key' => 'YOUR_APP_KEY',
'app_secret' => 'YOUR_APP_SECRET',
]);
$response = $client->sms()->send([
'dlt_template_id' => '1007452967110801758',
'mobile_numbers' => '919999999999',
'message' => 'This is your one time password {#var#}.',
'route_type' => '0',
'v1' => '123456',
]);
print_r($response);
$client = new Client([
'base_url' => 'https://ok-go.in',
'app_key' => 'YOUR_APP_KEY',
'app_secret' => 'YOUR_APP_SECRET',
]);
$client->sms()->send($payload);
$client->sms()->generateOtp($payload);
$client->sms()->campaignList($filters);
$client->sms()->templates();
$client->sms()->approvedSenderIds();
$client->whatsapp()->send($payload);
$client->whatsapp()->report($responseToken);
$client->whatsapp()->templates($templateName);
$client->email()->send($payload);
$client->email()->senderIdentities();
$client->email()->templates($templateName);
$client->email()->campaignList($filters);
$client->email()->report($responseToken);
$client->voice()->send($payload);
$client->voice()->sendOtp($payload);
$client->voice()->templates();
$client->account()->status();
$client->account()->balance();
$client->webhooks()->parse($payload);
$response = $client->email()->send([
'sender_id' => 2000000001,
'template_slug' => 'welcome-offer',
'recipient_email' => '[email protected] ',
'recipient_name' => 'Customer Name',
'attachment_paths' => [
'uploads/email-attachments/offer-terms.pdf',
'https://ok-go.in/uploads/email-attachments/catalog.pdf',
],
'variables' => [
'name' => 'Customer Name',
'coupon_code' => 'WELCOME10',
],
]);
$response = $client->whatsapp()->send([
'message' => [
'content' => [
'type' => 'TEMPLATE',
'template' => [
'templateId' => 'hello_world',
],
],
'recipient' => [
'to' => '919999999999',
'recipient_type' => 'individual',
],
'sender' => [
'from' => '15550622381',
],
],
]);
$response = $client->whatsapp()->send([
'message' => [
'content' => [
'type' => 'TEMPLATE',
'language' => 'en',
'template' => [
'templateId' => 'promotion_text_only',
'bodyParameterValues' => [
'0' => 'Amit',
'1' => 'WELCOME10',
],
],
],
'recipient' => ['to' => '919999999999', 'recipient_type' => 'individual'],
'sender' => ['from' => '15550622381'],
],
]);
$response = $client->whatsapp()->send([
'message' => [
'content' => [
'type' => 'template',
'language' => 'en',
'template' => [
'templateId' => 'order_update',
'bodyParameterValues' => [
['type' => 'text', 'parameter_name' => 'customer_name', 'text' => 'Amit'],
['type' => 'text', 'parameter_name' => 'order_id', 'text' => 'ORD12345'],
],
],
],
'recipient' => ['to' => '919999999999', 'recipient_type' => 'individual'],
'sender' => ['from' => '15550622381'],
],
]);
$response = $client->whatsapp()->send([
'message' => [
'content' => [
'type' => 'TEMPLATE',
'template' => [
'templateId' => 'confirm_interest',
'buttons' => [
'quickReplies' => [
['type' => 'QUICK_REPLY', 'index' => '0', 'payload' => 'Yes'],
['type' => 'QUICK_REPLY', 'index' => '1', 'payload' => 'No'],
],
],
],
],
'recipient' => ['to' => '919999999999', 'recipient_type' => 'individual'],
'sender' => ['from' => '15550622381'],
],
]);
$response = $client->whatsapp()->send([
'message' => [
'content' => [
'type' => 'MEDIA_TEMPLATE',
'template' => [
'templateId' => 'image_offer',
'media' => [
'type' => 'image',
'url' => 'https://ok-go.in/whatsapp-file/sample.jpg',
],
'bodyParameterValues' => [
'0' => 'Amit',
],
],
],
'recipient' => ['to' => '919999999999', 'recipient_type' => 'individual'],
'sender' => ['from' => '15550622381'],
],
]);
bash
composer