PHP code example of kemboielvis / smsgenius-php-sdk

1. Go to this page and download the library: Download kemboielvis/smsgenius-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/ */

    

kemboielvis / smsgenius-php-sdk example snippets




enius = new \Kemboielvis22\SmsgeniusPhpSdk\SMSGenius("APIKEY");

$sms = $smsGenius->SMSClass();
// delete Received message with the ID passed in as a parameter
$response = $sms->deleteReceivedMessages("id");
// Response is an array 

$sms = $smsGenius->SMSClass();
// Delete an SMS Campaign with a specific campaign ID
$response = $sms->deleteSMSCampaign("id");
//The response is an array 

$sms = $smsGenius->SMSClass();
// Delete a sent message with specific message id
$response = $sms->deleteSentMessage("id")
// Response is an array

$sms = $smsGenius->SMSClass();
//Get all devices connected with you account
$devices = $sms->getDevices();
// Devices is an array containing all devices connected with your account

$sms = $smsGenius->SMSClass();
// Get all pending messages
$pendingMessages = $sms->getPendingMessages();
// Pending Messages is an array 

$sms = $smsGenius->SMSClass();
// Get all Received Messages
$receivedMessages = $sms->getReceivedMessages();
// Received Messages is an array 

$sms = $smsGenius->SMSClass();
// Get all SMS Campaigns available
$smsCampaign = $sms->getSMSCampaigns();
// SMS Campaign is an array 

$sms = $smsGenius->SMSClass();
// Get all sent Messages
$sentMessages = $sms->getSentMessages();
// Sent messages is an array 

// For devices mode 
  $array = [      
      "mode" => "devices", // There are credits or devices
      "campaign" => "bulk test",
      "numbers" => "+254712123456,+639123456789,+639123456789",
      "groups" => "1,2,3,4", // ( OPTIONAL )
      "device" => "00000000-0000-0000-d57d-f30cb6a89289", // For type Devices
      "sim" => 1, // For type Devices
      "priority" => 1, // ( OPTIONAL ) For type Devices 
      "message" => "Hello World!"
  ];
// For credits mode
    $array = [      
      "mode" => "credits", // There are credits or devices
      "campaign" => "bulk test",      
      "groups" => "1,2,3,4",      
      "message" => "Hello World!"
  ];
  $sms = $smsGenius->SMSClass();
   // Send Single message
   $response = $sms->sendBulkSMS($array);
   // response is an array


// For mode device
$array = [ // your API secret from (Tools -> API Keys) page
      "mode" => "devices",
      "device" => "00000000-0000-0000-d57d-f30cb6a89289",
      "sim" => 1, // Sim slot number Only for devices
      "priority" => 1, // ( OPTIONAL ) If you want to send the messages as priority, 1 for yes and 2 for no. For "devices" mode only.
      "phone" => "+254712123456",
      "message" => "Hello World!"
];
// For Credits mode
$array = [ // your API secret from (Tools -> API Keys) page
      "mode" => "credits",      
      "phone" => "+254712123456",
      "message" => "Hello World!",
      "gateway" => 3, // gateway number You can get it from getGatewayRoutes()
];

$sms = $smsGenius->SMSClass();
// Send Single message
$response = $sms->sendSingleSMS($array);
// response is an array


$sms = $smsGenius->SMSClass();
// Start SMS Campaign
// Pass in the campaign ID To start the campaign
$campaign = $sms->startSMSCampaign("Campaign ID")
// Campaign is an array 


$sms = $smsGenius->SMSClass();
// Stop a SMS campaign.
// Pass the campaign ID as the parameter 
$campaign = $sms->stopSMSCampaign("Campaign ID");
// campaign is an array 


$account = $smsGenius->account();
// Get partner earnings
$earnings = $account->getPartnerEarnings();
// Earnings is an array 

$account = $smsGenius->account();
// Get remaining credits
$credits = $account->getRemainingCredits();
// Credits is an array

$account = $smsGenius->account();
// Get subscription packages
$packages = $account->getSubscriptionPackage();
// Subscription packages is an array 

$system = $smsGenius->System();
// Get all gateway routes
$routes = $system->getGatewayRoutes();
// Routes is an array 

$system = $smsGenius->System();
// Get all system shorteners
$shorteners = $system->getShorteners();
// Shortners is an Array

$ussd = $smsGenius->USSD();
// Clear pending USSD's 
$response = $ussd->clearPendingUSSD();
// Response is an array

$ussd = $smsGenius->USSD();
// Delete a USSD request
$response = $ussd->deleteUSSDRequest("USSDID");
// Response is an array

$ussd = $smsGenius->USSD();
// Get all USSD request
$allUssd = $ussd->getUSSDRequest();
// all USSD is an array

$array = [

];
$ussd = $smsGenius->USSD();
// Send a USSD request
$response = $ussd->sendUSSDRequest();
// Response is an array

$array = [

];
$otp = $smsGenius->OTPClass();
// Send an otp to a specific phone number
$response = $otp->sendOTP();
// Response is an array 

$otp = $smsGenius->OTPClass();
// Verify a sent OTP
$response = $otp->verifyOTP("OTP");
// Response is an array

$whatsapp = $smsGenius->WhatsApp();
// Delete a specific Chat ID
$response = $whatsapp->deleteReceivedChat("chatID");
// Get the response (array)

$whatsapp = $smsGenius->WhatsApp();
// Delete a sent chat with a specific ID
$response = $whatsapp->deleteSentChat("chatID");
// Get the response (array)

$whatsapp = $smsGenius->WhatsApp();
// Delete whatsapp campaign
$response = $whatsapp->deleteWhatsAppCampaign("chatid");
// Get the response (array)

$whatsapp = $smsGenius->WhatsApp();
// Get accounts
$accounts = $whatsapp->getAccounts();
// Get response 

$whatsapp = $smsGenius->WhatsApp();
// Get pending chats
$pending = $whatsapp->getPendingChats();
// Get response (Array)

$whatsapp = $smsGenius->WhatsApp();
// Get received chats
$received = $whatsapp->getReceivedChats();
// Get response  (array)

$whatsapp = $smsGenius->WhatsApp();
// Get sent messages
$sent = $whatsapp->getSentChats();
// response ( Array )

$whatsapp = $smsGenius->WhatsApp();
// Get WhatsApp Campaign Chats
$campaign = $whatsapp->getWhatsAppCampaign();
// Response (Array)

$array = [
      "account" => 1, // account ID
      "campaign" => "bulk test",
      "numbers" => "+254712123456,+639123456789,+639123456789",
      "groups" => "1,2,3,4", // ( OPTIONAL )
      "message" => "Hello World!",
      "type" => "text" // "text", "media", "button", "list", "template"
];
$whatsapp = $smsGenius->WhatsApp();
// Send Bulk Messages
$response = $whatsapp->sendBulkChat($array);
// Response ( Array )

$array = [
      "account" => 1, // Account id
      "recipient" => "+254712123456",
      "type" => "text", // "text", "media", "button", "list", "template"
      "message" => "Hello World!"
];
$whatsapp = $smsGenius->WhatsApp();
// Send Single Message
$response = $whatsapp->sendSingleChat($array);
// Get response ( Array )

$whatsapp = $smsGenius->WhatsApp();
// Start WhatsApp Campaign
$response = $whatsapp->startWhatsAppCampaign("campaignID");
// Response ( Array )

$whatsapp = $smsGenius->WhatsApp();
// Stop WhatsApp Campaign
$response = $whatsapp->stopWhatsAppCampaign("campaignID");
// Response ( Array )
 
 composer