System Print

  • 0

For businesses that use SMS messaging services, managing gateway rates and URL shorteners is essential for cost-efficiency and ease of access. WaSMS SMS API provides endpoints to retrieve current gateway rates and available shorteners. Here’s a guide on how to implement these endpoints in your WHMCS knowledge base.


1. Retrieving Gateway Rates

To retrieve gateway rates, use the following endpoint:

  • Endpoint: GET https://sys.wasms.net/api/get/rates
  • Required Permission: get_rates

Parameters:

  • secret: Your API secret, which you can get from (Tools -> API Keys) in your account.

Sample Request (PHP):

php
$apiSecret = "YOUR_API_SECRET";
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, "https://sys.wasms.net/api/get/rates?secret={$apiSecret}");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
print_r($result);

Success Response: The response includes details about gateways and partner devices with their respective rates and supported currencies.

json
{ "status": 200, "message": "Gateway Rates", "data": { "gateways": [ { "id": 1, "name": "Twilio", "currency": "GBP", "pricing": { "default": "0.01", "countries": { "us": "0.01", "ph": "10", "gb": "0.02" } } } ], "partners": [ { "unique": "00000000-0000-0000-d57d-f30cb6a89289", "name": "F11 Phone", "version": "Android 11", "priority": false, "sim": ["2"], "country": "PH", "currency": "PHP", "rate": 5, "owner": "[email protected]", "status": "online" } ] } }

2. Retrieving Available Shorteners

The SMS API also provides access to a list of URL shorteners that can be used within SMS messages.

  • Endpoint: GET https://sys.wasms.net/api/get/shorteners
  • Required Permission: get_shorteners

Parameters:

  • secret: Your API secret.

Sample Request (PHP):

php
$apiSecret = "YOUR_API_SECRET";
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, "https://sys.wasms.net/api/get/shorteners?secret={$apiSecret}");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
print_r($result);

Success Response: The response lists available shorteners that can be used within the WaSMS platform.

json
{ "status": 200, "message": "Available Shorteners", "data": [ { "id": 1, "name": "Bitly" } ] }

Error Responses

Both endpoints return standardized error responses:

json
{ "status": 400, "message": "Invalid Parameters!", "data": false }

By integrating these API calls, WHMCS users can easily keep track of SMS gateway rates and manage URL shorteners for streamlined and cost-effective messaging.


Was this answer helpful?

« Back