Connect and send messages via WhatsApp Web.js
Loading.../api/external/send-message
https://your-app-url.com/api/external/send-messagePOSTapplication/json
{
"number": "60122273341",
"message": "Hello from API!"
}
60122273341 or +60122273341. The API automatically adds the @s.whatsapp.net suffix.120363424584075789@g.us).1234567890@newsletter).{
"success": true,
"message": "Message sent successfully",
"messageId": "BAE1234567890ABCDEF",
"recipient": "60122273341",
"timestamp": "2024-01-15T10:30:00.000Z"
}
{
"error": "WhatsApp client is not ready",
"details": "Connection not established"
}
curl -X POST "https://your-app-url.com/api/external/send-message" \
-H "Content-Type: application/json" \
-d '{
"number": "60122273341",
"message": "Hello from API!"
}'
const response = await fetch('https://your-app-url.com/api/external/send-message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
number: '60122273341',
message: 'Hello from Node.js!'
})
});
const result = await response.json();
console.log(result);
import requests
import json
url = 'https://your-app-url.com/api/external/send-message'
payload = {
'number': '60122273341',
'message': 'Hello from Python!'
}
response = requests.post(url, json=payload)
result = response.json()
print(result)
fetch('https://your-app-url.com/api/external/send-message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
number: '60122273341',
message: 'Hello from browser!'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
1. Check Status: Visit https://your-app-url.com/api/health
2. Test with cURL:
curl -X POST "https://your-app-url.com/api/external/send-message" \
-H "Content-Type: application/json" \
-d '{"number": "YOUR_PHONE_NUMBER", "message": "Test message"}'
3. Verify: Check your WhatsApp to confirm message delivery