API UhuyNET
aPays - API UhuyNET

Required variables
- client_id = Your Client ID
- mobile = WhatsApp Number
- text = Text To Send
- API KEYS = Your API Key
How To Get Client ID and API Keys?
- Sign Up anda Login UhuyNET
- Subcribe a Free Account
- Connected Your Whatsapp Device
- Manage Instance
- Select Pairing Device or Scan QR Code
- After Connected there will be a Client ID Click and Copy
- Click Menu API Access
- Generate API Key
- Copy and Paste API Key
PHP
Sending Text Message
function sendMessage() {
$url = 'https://uhuy.net/api/user/v2/send_message_url'; // DO NOT INCLUDE WWW
$clientId = 'CLIENT_ID';
$mobile = '918888888888';
$text = 'Hello';
$token = 'YOUR_API_KEYS';
$queryParams = http_build_query([
'client_id' => $clientId,
'mobile' => $mobile,
'text' => $text,
'token' => $token
]);
$apiUrl = $url . '?' . $queryParams;
$response = file_get_contents($apiUrl);
$data = json_decode($response, true);
if ($data) {
echo 'Response: ';
print_r($data);
} else {
echo 'Error: Unable to retrieve data.';
}
}
sendMessage();
Sending text message
function sendTextMessage() {
$url = 'https://uhuy.net/api/user/v2/send_message'; // DO NOT INCLUDE WWW
$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'; // DO NOT INCLUDE WWW
$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": {}
}