Meta Cloud API Guide

Send WhatsApp messages using your secure API key.

Send Message Endpoint

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.

Endpoint:
POST https://www.webwms2u.com/api/send-message.php
Headers:
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Supported Key Types:
Request Body Parameters:
Credit Usage
Example JSON Requests:
1. Plain Text Message
{
  "message": "Hello from the API!",
  "direct_number": "60123456789"
}
2. Template Message with Custom Fields
{
  "template_id": "123",
  "direct_number": "60123456789",
  "custom_fields": { "1": "John", "2": "Promo2025" },
  "send_time": "2025-06-23 14:30:00"
}
3. Media Message (Image)
{
  "message": "Check out this image",
  "direct_number": "60123456789",
  "message_type": "media",
  "message_payload": {
    "type": "image",
    "url": "https://www.example.com/images/promo.jpg"
  }
}
4. Document / PDF Message
{
  "message": "Please see attached document",
  "direct_number": "60123456789",
  "message_type": "media",
  "message_payload": {
    "type": "document",
    "url": "https://www.example.com/files/brochure.pdf"
  }
}
5. Location Message
{
  "message": "Our office location",
  "direct_number": "60123456789",
  "message_type": "media",
  "message_payload": {
    "type": "location",
    "latitude": 3.13021923866952,
    "longitude": 101.68375694232802,
    "name": "WMS Cloud Office",
    "address": "Brickfields, Kuala Lumpur"
  }
}
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",
  "message_type" => "media", // "text", "media", "document", "location"
  "message_payload" => [
    "type" => "image",
    "url" => "https://www.example.com/images/promo.jpg"
  ]
];

$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 Response:
{
  "success": true,
  "message": "Message queued",
  "cost": 1
}
Error Responses:
Notes: