Table of Contents

Integrating an API with the Custom Dev Kit

This page explains the necessary steps to integrate any 3rd party SMS API gateway into MyRSK's PVS Module using the Custom Dev Kit.

Requirements

Please Remember

The Steps

Example

The example shows how to integrate Clickatell's API using the Custom Dev Kit.

customdevkit.php
<?php
#  Layer's Phone Verification System for WHMCS (Custom Dev Kit Example)
#
#  This file contains an example to help you integrate any SMS provider API's gateway. 
#  The example below shows how to integrate Clickatell's API into Layer's PVS Module.
#  Please be advised that we do not provide support for custom integrations. 
#
#  $phone will be automatically supplied, and contains the customer's phone number
#  $code will be automatically supplied, and contains a 4 digit code
#
#  Example is provided below

 
#provide api credentials
$apiid="123456";
$apiuser="username";
$apipassword="password123";
 
#provide the content of the SMS message - remember to include the $code variable in your message, as that is the code to be sent to the customer
$body="Hello! The verification code is: ".$code.". Thank you for verifying your account!";
 
#build the API request
$url = 'http://api.clickatell.com/http/sendmsg?' . http_build_query([
        'user' => $apiuser,
        'password' => $apipassword,
	'api_id' => $apiid,
        'to' => $phone,
        'text' => $body
    ]);
 
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$clickatell = curl_exec($ch);
 
 
#log the attempt to help troubleshoot
logModuleCall("myrskpvs","customdevkit-sms",$url,$clickatell);
 
?>