Skip to content

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

ParameterTypeRequiredDescription
sender_devicestringYesThe sender device mobile number
phonestringYesThe recipient phone number
messagestringYesThe 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

ParameterTypeRequiredDescription
sender_devicestringYesThe sender device mobile number
phonestringYesThe recipient phone number
mediastringYesURL or base64 encoded image data
captionstringNoOptional 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

ParameterTypeRequiredDescription
sender_devicestringYesThe sender device mobile number
phonestringYesThe recipient phone number
mediastringYesURL of the video file
captionstringNoOptional 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

ParameterTypeRequiredDescription
sender_devicestringYesThe sender device mobile number
phonestringYesThe recipient phone number
mediastringYesURL 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

ParameterTypeRequiredDescription
sender_devicestringYesThe sender device mobile number
phonestringYesThe recipient phone number
mediastringYesURL of the file to send
captionstringNoOptional 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

ParameterTypeRequiredDescription
sender_devicestringYesThe sender device mobile number
phonestringYesThe recipient phone number
latnumberYesLatitude coordinate
lngnumberYesLongitude 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."

Released under the MIT License.