API DOC (PHP)

API
Jul 30, 2024 11 mins read

WANotif PRO Dokumentasi API

PHP

Sending Text Message

Required variables

  • client_id = Your Client ID CLICK HERE
  • mobile = WhatsApp Number
  • text = Text To Send
  • API KEYS = Your API Key CLICK HERE
function sendTextMessage() {
        $url = 'https://uhuy.net/api/user/v2/send_message';
        $body = [
            'client_id' => 'CLIENT_ID', // Client ID here
            'mobile' => '919999999999',
            'text' => 'Hello world',
        ];
        $token = 'YOUR_API_KEYS'; // Your API keys here
      
        $headers = [
            'Content-Type: application/json',
            'Authorization: Bearer ' . $token,
        ];
      
        try {
            $curl = curl_init($url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($body));
      
            $response = curl_exec($curl);
      
            if ($response === false) {
                throw new Exception(curl_error($curl));
            }
      
            $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            if ($httpCode >= 400) {
                throw new Exception('Request failed');
            }
      
            $data = json_decode($response, true);
            print_r($data); // Handle the response data as per your requirements
        } catch (Exception $error) {
            echo $error->getMessage();
        }
    }
      
    sendTextMessage();

Sending Template Message

Required variables 

  • client_id
  • mobile 
  • templet_id 
  • API KEYS
function sendTextMessage() {
        $url = 'https://uhuy.net/api/user/v2/send_templet'; // Replace with your domain endpoint
    
        $body = [
            'client_id' => 'CLIENT_ID', // Client ID here
            'mobile' => '919999999999',
            'templet_id' => 1, // Your templet ID
        ];
    
        $token = 'YOUR_API_KEYS'; // Your API keys here
    
        $headers = [
            'Content-Type: application/json',
            'Authorization: Bearer ' . $token,
        ];
    
        try {
            $curl = curl_init($url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($body));
    
            $response = curl_exec($curl);
    
            if ($response === false) {
                throw new Exception(curl_error($curl));
            }
    
            $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            if ($httpCode >= 400) {
                throw new Exception('Request failed');
            }
    
            $data = json_decode($response, true);
            print_r($data); // Handle the response data as per your requirements
        } catch (Exception $error) {
            echo $error->getMessage();
        }
    }
    
    sendTextMessage();

Successful Response

{
  "success": true,
  "message": "The message has been successfully sent.",
  "data": {}
}