Send WhatsApp messages using your secure API key.
This endpoint allows you to send WhatsApp messages via your API key.
POST https://www.webwms2u.com/api/send-message.php
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
message
(string) - Required. The plain message text.template_id
(string) - Optional. If provided, will override message
.direct_number
(string) - Optional. Send directly to a phone number in international format.send_time
(string) – Optional. Schedule time in UTC using the format YYYY-MM-DD HH:MM:SS
.2025-06-24 14:00:00
(UTC). If not provided, the message will be sent immediately.
custom_fields
(array) - Optional. Array of values to fill {{1}}, {{2}}, etc. in template.{
"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