API Guide

Send WhatsApp messages using your secure API key.

Send Message Endpoint

This endpoint allows you to send WhatsApp messages via your API key.

Endpoint:
POST https://www.webwms2u.com/api/send-message.php
Headers:
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Request Body Parameters:
Example JSON Request:
{
  "message": "Hello from the API!",
  "direct_number": "60123456789"
}
PHP Sample Code:
<?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 Sample Code: With Template, Custom Fields & Scheduling
<?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;
}
?>

Download Sample PHP (ZIP)

Success Response:
{
  "success": true,
  "message": "Message queued",
  "cost": 1
}
Error Responses:
Notes: