API requests

API requests are sent to:

https://whatsgate.org/api/v1/<command>

List of commands for WhatsApp instance management:

  • send - send messages
  • seen - marks latest chat messages as seen for the other participant
  • typing - sends the “typing” status to the other participant for 15 seconds
  • get-chats - request chat list
  • get-media - request media file
  • check - check whether a number is registered in WhatsApp
  • events-get - request incoming events to receive incoming messages

List of session management commands:

API authorization is done via the X-Api-Key request header. The Content-type: application/json header is also required.

X-Api-Key: YOUR_API_KEY
Content-type: application/json

A JSON object is sent in the request body, with WhatsappID as a required parameter.

{
  "WhatsappID": "YOUR_WHATSAPP_ID",
  "number": "79999999999"
}

If everything succeeds, the response code is 200 and the body contains a JSON object. JSON fields depend on the command used.

{
  "result": "OK",
  "data": true
}

On error, the response code is 500. The returned object contains:

  • name - error name
  • message - more detailed error information
  • code - error code
{
  "name": "Unauthorized",
  "message": "Your request was made with invalid credentials.",
  "code": 0
}