WHATSAPP API

Send API WhatsApp Text

Send WhatsApp text messages to your customers using our API.

API Endpoint

POST https://darajapay.com/api/v1/whatsapp/send

Headers

{
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

Request Body

{
    "message_type": "text",
    "session": "YOUR_SESSION_ID",
    "message": "Hello, this is a test message",
    "recipient": "254712345678"
}

Response

{
    "status": "success",
    "message": "Message sent successfully",
    "message_id": "msg_123456789"
}

Code Examples

PHP
 'text',
    'session' => 'YOUR_SESSION_ID',
    'message' => 'Hello, this is a test message',
    'recipient' => '254712345678'
);

$headers = array(
    'Content-Type: application/json',
    'Authorization: Bearer YOUR_API_KEY'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;