kemboielvis/smsgenius-php-sdk

SMS Genius php sdk

v1.1.0 2024-02-12 13:05 UTC

This package is auto-updated.

Last update: 2024-09-12 14:21:21 UTC


README

此SDK帮助用户轻松地将应用程序与SMSGenius API集成以发送消息

官方文档在sms.genius.ke

您可以使用composer安装php sdk

 composer require kemboielvis/smsgenius-php-sdk

SMS Genius平台可以完成以下操作
1. 向任何网络发送短信
2. 发送WhatsApp消息

如何使用SDK

  1. 使用短信平台

    首先初始化主类,并将API密钥作为参数传入

    您可以从sms.genius.ke获取API密钥,转到工具并添加新的密钥。您可以添加其权限

<?php

require "./vendor/autoload.php";

$smsGenius = new \Kemboielvis22\SmsgeniusPhpSdk\SMSGenius("APIKEY");
  • 删除收到的消息 [参数(id)]
  • $sms = $smsGenius->SMSClass();
    // delete Received message with the ID passed in as a parameter
    $response = $sms->deleteReceivedMessages("id");
    // Response is an array 
  • 删除短信活动 [参数(id)]
  • $sms = $smsGenius->SMSClass();
    // Delete an SMS Campaign with a specific campaign ID
    $response = $sms->deleteSMSCampaign("id");
    //The response is an array 
  • 删除已发送的消息 [参数(id)]
  • $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
  • 启动短信活动 [参数(活动ID)]
  • $sms = $smsGenius->SMSClass();
    // Start SMS Campaign
    // Pass in the campaign ID To start the campaign
    $campaign = $sms->startSMSCampaign("Campaign ID")
    // Campaign is an array 
  • 停止短信活动 [参数(活动ID)]
  • $sms = $smsGenius->SMSClass();
    // Stop a SMS campaign.
    // Pass the campaign ID as the parameter 
    $campaign = $sms->stopSMSCampaign("Campaign ID");
    // campaign is an array 
    1. 账户
  • 获取合作伙伴收入
  • $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 
    1. 系统
  • 获取网关路由
  • $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

    4 USSD

  • 清除待处理的USSD
  • $ussd = $smsGenius->USSD();
    // Clear pending USSD's 
    $response = $ussd->clearPendingUSSD();
    // Response is an array
  • 删除USSD请求 [参数(ussdid) ]
  • $ussd = $smsGenius->USSD();
    // Delete a USSD request
    $response = $ussd->deleteUSSDRequest("USSDID");
    // Response is an array
  • 获取USSD请求
  • $ussd = $smsGenius->USSD();
    // Get all USSD request
    $allUssd = $ussd->getUSSDRequest();
    // all USSD is an array
  • 发送USSD请求
  • $array = [
    
    ];
    $ussd = $smsGenius->USSD();
    // Send a USSD request
    $response = $ussd->sendUSSDRequest();
    // Response is an array
    1. OTP
  • 发送OTP
  • $array = [
    
    ];
    $otp = $smsGenius->OTPClass();
    // Send an otp to a specific phone number
    $response = $otp->sendOTP();
    // Response is an array 
  • 验证OTP [参数(OTP代码) ]
  • $otp = $smsGenius->OTPClass();
    // Verify a sent OTP
    $response = $otp->verifyOTP("OTP");
    // Response is an array
    1. WhatsApp消息
  • 删除收到的聊天
  • $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活动
  • $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聊天
  • $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活动聊天
  • $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活动 [参数(campaignID) ]
  • $whatsapp = $smsGenius->WhatsApp();
    // Start WhatsApp Campaign
    $response = $whatsapp->startWhatsAppCampaign("campaignID");
    // Response ( Array )
  • 停止WhatsApp活动 [参数(campaignID) ]
  • $whatsapp = $smsGenius->WhatsApp();
    // Stop WhatsApp Campaign
    $response = $whatsapp->stopWhatsAppCampaign("campaignID");
    // Response ( Array )