Appearance
Messages API
The Messages API allows you to send various types of WhatsApp messages to recipients.
Send Text Message
Send a text message to a WhatsApp number.
Endpoint
POST /send/text
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender_device | string | Yes | The sender device mobile number |
phone | string | Yes | The recipient phone number |
message | string | Yes | The message text (max 4000 characters) |
Example Request
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/text \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "123456789",
"phone": "987654321",
"message": "Hello, this is a test message"
}'
Example Response
json
{
"success": true,
"message": "Message sent successfully"
}
Send Image Message
Send an image message to a WhatsApp number.
Endpoint
POST /send/image
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender_device | string | Yes | The sender device mobile number |
phone | string | Yes | The recipient phone number |
media | string | Yes | URL or base64 encoded image data |
caption | string | No | Optional caption for the image (max 4000 characters) |
Example Request
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/image \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "123456789",
"phone": "987654321",
"media": "https://example.com/image.jpg",
"caption": "Check out this image"
}'
Example Response
json
{
"success": true,
"message": "Image sent successfully"
}
Send Video Message
Send a video message to a WhatsApp number.
Endpoint
POST /send/video
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender_device | string | Yes | The sender device mobile number |
phone | string | Yes | The recipient phone number |
media | string | Yes | URL of the video file |
caption | string | No | Optional caption for the video (max 4000 characters) |
Example Request
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/video \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "123456789",
"phone": "987654321",
"media": "https://example.com/video.mp4",
"caption": "Check out this video"
}'
Example Response
json
{
"success": true,
"message": "Video sent successfully"
}
Send Audio Message
Send an audio message to a WhatsApp number.
Endpoint
POST /send/audio
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender_device | string | Yes | The sender device mobile number |
phone | string | Yes | The recipient phone number |
media | string | Yes | URL of the audio file |
Example Request
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/audio \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "123456789",
"phone": "987654321",
"media": "https://example.com/audio.mp3"
}'
Example Response
json
{
"success": true,
"message": "Audio sent successfully"
}
Send File/Document Message
Send a document or file to a WhatsApp number.
Endpoint
POST /send/file
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender_device | string | Yes | The sender device mobile number |
phone | string | Yes | The recipient phone number |
media | string | Yes | URL of the file to send |
caption | string | No | Optional caption for the file (max 4000 characters) |
Example Request
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/file \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "123456789",
"phone": "987654321",
"media": "https://example.com/document.pdf",
"caption": "Important document"
}'
Example Response
json
{
"success": true,
"message": "File sent successfully"
}
Send Location Message
Send a location message to a WhatsApp number.
Endpoint
POST /send/location
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sender_device | string | Yes | The sender device mobile number |
phone | string | Yes | The recipient phone number |
lat | number | Yes | Latitude coordinate |
lng | number | Yes | Longitude coordinate |
Example Request
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/location \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "123456789",
"phone": "987654321",
"lat": 37.7749,
"lng": -122.4194
}'
Example Response
json
{
"success": true,
"message": "Location sent successfully"
}
Error Responses
If there's an error with your request, you'll receive a response with a success
field set to false
and a message
field describing the error:
json
{
"success": false,
"message": "Error message"
}
Common error messages include:
- "The selected sender device is invalid."
- "The phone field is required."
- "The media field is required."
- "The media must be a valid URL."
- "The message field is required."
- "The message may not be greater than 4000 characters."