Docs
Whatsapp Api Integration
Whatsapp Api Integration
Integrate whatsapp api to send notification from your application and website.
Implement the PHP code to make a POST request to the WhatsApp API endpoint with the prepared data.
1.PHP Implementation
<?php
// Prepare data
$data = [
'api_key' => 'Your_API_Key',
'sender' => 'Your_Sender_Name',
'number' => 'Recipient_Phone_Number',
'message' => 'Your_Message_Content'
];
// Initialize CURL
$curl = curl_init();
// Set CURL options
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://saakshi.cloud/send-message', // WhatsApp API endpoint URL
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($data), // Convert data to JSON format
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
// Execute CURL request
$response = curl_exec($curl);
// Close CURL connection
curl_close($curl);
// Output response
echo $response;
?>
Test the integration by executing the PHP script. Verify that the message is successfully sent to the recipient’s WhatsApp number.
Congratulations! You have successfully integrated WhatsApp API into your PHP application. You can now send messages programmatically to WhatsApp users
Contact us to obtain the API Key required for authentication.