> For the complete documentation index, see [llms.txt](https://layerlabs.gitbook.io/phone-verification-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://layerlabs.gitbook.io/phone-verification-system/advanced/custom-sms-gateway-dev-kit.md).

# Custom SMS Gateway Dev Kit

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

### Requirements <a href="#requirements" id="requirements"></a>

* API access credentials for the 3rd party SMS/API gateway
* Knowledge of PHP

### Please Remember <a href="#please_remember" id="please_remember"></a>

* `$phone` variable will be automatically supplied, and contains the customer's phone number
* `$code` variable will be automatically supplied, and contains a 4 digit code

### The Steps <a href="#the_steps" id="the_steps"></a>

* open customdevkit.php file (which can be found in the Layer's PVS Module folder)
* provide the API credentials in the script, this depends on the Gateway provider. Some call them username/passwords, while others give them different names
* provide the content of the SMS message in the `$body` variable, remember to include the `$code` variable in your message, as that is the code to be sent to the customer
* build & execute the api request (have a look at example files from your gateway provider)
* log the API Request attempt to help troubleshoot

### Example <a href="#example" id="example"></a>

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

```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);
 
?>
```

{% file src="/files/ce0ewdFa7Rx0LYnC48Rb" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://layerlabs.gitbook.io/phone-verification-system/advanced/custom-sms-gateway-dev-kit.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
