POST https://api.sensibot.io/whatsapp/send
Headers
[
'Content-Type: application/json',
'Authorization: Bearer {YOUR_API_TOKEN} >'
]
Parameter
Field | Type | Description |
---|---|---|
wa_number | String |
whatsapp number you want to use for sending including country code |
recipient | String |
Recipient mobile number with country code and + sign |
type | String |
Type of WhatsApp message. Allowed values:
|
message | String |
Message or caption you want to send |
media_url (optional) | String |
This is for "media" type message only. The media file url, please use direct link to the media file. It will be downloaded and be attached in the WhatsApp message, it also supports jpg, png, gif, mp4, mp3, and ogg files. |
media_type (optional) | String |
This is for "media" type message only. You only need to enter this parameter if you are using "media_url". You need to declare the file type of the media in the url you provided. Allowed values:
|
document_url (optional) | String |
This is for "document" type message only. The document file url, please use direct link to the document file. It will be downloaded and be attached in the WhatsApp message, it also supports pdf, xls, xlsx, doc, and docx files. |
document_type (optional) | String |
This is for "document" type message only. You only need to enter this parameter if you are using "document_url" . You need to declare the file type of the document in the url you provided. Allowed values:
|
Success Response Format
Field | Type | Description |
---|---|---|
status | Number |
List of Codes |
message | String |
Response message |
data | Array |
Array of data |
Error Response Format
Name | Type | Description |
---|---|---|
status | Number |
List of Codes |
message | String |
Response message |
data | Array |
Array of data |
PHP Example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.sensibot.io/whatsapp/send',
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 =>'{
"wa_number":"+XXXXXXXXXX",
"type":"text",
"recipient":"+XXXXXXXXXX",
"message":"hi,this is text message"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer {YOUR_API_TOKEN}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;