WhatsApp API Integration in DMA Softlab Radius Manager

How to Integrate Whatsapp API in DMA Softlab Radius Manager

This tutorial explains how to integrate any SMS HTTP API with DMA Softlab Radius Manager to send SMS notifications such as account activation, password recovery, and expiry alerts.


1. SMS Support in Radius Manager

DMA Softlab Radius Manager has built-in support for SMS/Whatsapp notifications. It sends messages through a PHP gateway file when certain events occur:

  • User account activation
  • OTP / verification codes
  • Password recovery
  • Account expiry warnings

2. Choose Whatsapp API Provider

You can use whapiplus.com that offers an HTTP GET or POST API. You will need:

  • Whatsapp API URL
  • API Key or Token
  • WAID (Whatsapp Unique ID)

3. Locate SMS Gateway File

Login to your server and locate the SMS gateway file. The common path is:

/var/www/html/radiusmanager/api/smsgateway.php

Important: Always take a backup before editing.

cp smsgateway.php smsgateway.php.bak

4. Edit SMS Gateway File

Open the file using nano or any editor:

nano smsgateway.php

Replace or modify the SMS sending function with your SMS API code.


5. Sample PHP Code for SMS API

Below is a generic PHP example. Replace API URL and parameters according to your SMS provider documentation.

<?php

function sendsms($recp, $body, &$errmsg) {
    
    $apikey  = "";
    $waid    = "";
    $message = rawurlencode($body);
    $number  = rawurlencode($recp);

    $url = "https://hajanaone.com/whapi/send.php?apikey=$apikey&waid=$waid&number=$number&message=$message";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $response = curl_exec($ch);

    echo  $response; 

    curl_close($ch);

    if ($response) {
        return true;
    } else {
        $errmsg = "SMS sending failed";
        return false;
    }
}

?>

6. Enable SMS Notifications

Login to Radius Manager Admin Panel:

  • Go to System ? System Settings
  • Enable SMS notifications
  • Select events like activation, expiry alerts, and password reset

7. Customize SMS Templates

SMS message templates are stored in the language folder:

/var/www/html/radiusmanager/lang/English/

Common template files:

  • smswelcomeuser_tpl.txt
  • smsaccverify_tpl.txt
  • smswarnexp_tpl.txt

You can edit these files to customize SMS text.


8. Testing

After configuration, test SMS delivery by:

  • Creating a new user account
  • Triggering password recovery
  • Waiting for expiry alert SMS

If Whatsapp Message is not delivered, check:

  • API response
  • Server firewall
  • Correct phone number format

Conclusion

Integrating Whatsapp API in DMA Softlab Radius Manager allows automated communication with users. Any HTTP-based Whatsapp API provider can be used by modifying the SMS gateway PHP file.

Tip: Always use HTTPS and keep your API keys secure.