Send WhatsApp messages using your secure API key.
This single API endpoint supports both Meta Cloud API Keys and Personal Device API Keys. Based on your key type, the platform will route the message to the correct WhatsApp infrastructure automatically.
POST https://www.webwms2u.com/api/send-message.php
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Feature | Meta Cloud API | Personal Device API |
---|---|---|
Message Type | Templates or within 24h window | Free-form messages |
Template Required? | Yes, unless replying to a user within 24h | No template needed |
Phone Number Type | Business phone number linked with Meta | Any WhatsApp-registered mobile number |
Quota Limits | Subject to Meta tier limits (1K-100K) | No official limit (depends on device stability) |
Reliability | Highly stable, suitable for scale | May disconnect if WhatsApp Web is opened elsewhere |
message
(string) – Required unless using template. Plain message text.template_id
(string) – Optional. Required for Meta if sending outside 24h window.direct_number
(string) – Required. WhatsApp number in international format (e.g. 60123456789
).send_time
(string) – Optional. Schedule time in UTC (YYYY-MM-DD HH:MM:SS
).custom_fields
(array) – Optional. Used only with templates to populate variables like {{1}}
, {{2}}
.{
"message": "Hello from the API!",
"direct_number": "60123456789"
}
<?php
$apiUrl = "https://www.webwms2u.com/api/send-message.php";
$apiKey = "YOUR_API_KEY_HERE";
$data = [
"message" => "Hello from the API!",
"direct_number" => "60123456789"
];
$options = [
"http" => [
"header" => "Content-Type: application/json\r\nX-API-KEY: $apiKey\r\n",
"method" => "POST",
"content" => json_encode($data)
]
];
$context = stream_context_create($options);
$response = @file_get_contents($apiUrl, false, $context);
if ($response === false) {
echo "API call failed";
} else {
echo "Response: " . $response;
}
?>
<?php
$apiUrl = "https://www.webwms2u.com/api/send-message.php";
$apiKey = "YOUR_API_KEY_HERE";
$data = [
"template_id" => "123", // Your template ID
"direct_number" => "60123456789",
"send_time" => "2025-06-23 14:30:00",
"custom_fields" => [
1 => "John",
2 => "Promo2025",
3 => "June"
]
];
$options = [
"http" => [
"header" => "Content-Type: application/json\r\nX-API-KEY: $apiKey\r\n",
"method" => "POST",
"content" => json_encode($data)
]
];
$context = stream_context_create($options);
$response = @file_get_contents($apiUrl, false, $context);
if ($response === false) {
echo "API call failed";
} else {
echo "Response: " . $response;
}
?>
{
"success": true,
"message": "Message queued",
"cost": 1
}
401 Unauthorized
- Invalid or missing API key400 Bad Request
- Required fields missing or invalid403 Forbidden
- Insufficient credits or not allowed