API Reference
Sending Messages
Send WhatsApp messages programmatically from your app or website using the RabtCRM API.
First, make sure you have a valid API key and an active WhatsApp instance.
Send a Text Message
Request:
POST https://rabtcrm.com/api/v1/messages/send
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body:
{
"instanceName": "your-instance-name",
"to": "201012345678",
"message": "Hello! This is a message from RabtCRM."
}
Fields:
| Field | Type | Description |
|---|---|---|
instanceName | string | WhatsApp instance name (from the Instances page) |
to | string | Recipient number in international format, no + |
message | string | Message text |
Success Response:
{
"success": true,
"messageId": "3EB0C767D360",
"status": "sent"
}
Send an Image
{
"instanceName": "your-instance-name",
"to": "201012345678",
"type": "image",
"mediaUrl": "https://example.com/image.jpg",
"caption": "Check out our new product π¦"
}
Send a Document (PDF)
{
"instanceName": "your-instance-name",
"to": "201012345678",
"type": "document",
"mediaUrl": "https://example.com/invoice.pdf",
"filename": "Invoice.pdf"
}
Send Interactive Buttons
{
"instanceName": "your-instance-name",
"to": "201012345678",
"type": "buttons",
"message": "How can we help you?",
"buttons": [
{ "id": "1", "text": "Technical Support" },
{ "id": "2", "text": "Track Order" },
{ "id": "3", "text": "Talk to Agent" }
]
}
Sending to Multiple Recipients
For bulk sending, use the Broadcast feature from the platform UI β the API is designed for individual sends, not mass messaging.
Warning: Sending large volumes of messages rapidly via API can get your number banned. Use Broadcasts for safe bulk sending.
Tracking Message Status
The response contains a messageId. You can track delivery from the conversation view inside the platform:
| Status | Meaning |
|---|---|
sent | Message dispatched from the server |
delivered | Message reached the recipient's phone |
read | Recipient read the message ββ |
failed | Send failed β check error details |
Code Examples
Node.js
const axios = require('axios');
await axios.post('https://rabtcrm.com/api/v1/messages/send', {
instanceName: 'my-instance',
to: '201012345678',
message: 'Hello from my app!',
}, {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
});
PHP
$ch = curl_init('https://rabtcrm.com/api/v1/messages/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'instanceName' => 'my-instance',
'to' => '201012345678',
'message' => 'Hello from PHP!',
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);