W2A
Documentation engine

Requests

See how to send messages, and query informations

After you got a token to request, you can start to sending requests.
All requests happen in a single endpoint changing the method and params in the body.
Use the Documentation engine switch at the top to view docs that match your connection's engine.

There's a lib for nodejs here: Click here

Important Information

All our endpoints expect and return JSONs. You can test it using Postman or Insomnia.

Engine: baileys (JS)

You are viewing Baileys docs. Baileys uses camelCase method names (sendMessage, groupCreate) and JSON message shapes — see Non-Media/Media Messages examples below. Responses are JSON-serialized Baileys WAMessage objects. Persistence: Mongo connections-auth collection.

Endpoint: [POST] https://api.whats2api.com/connections/request

Headers:

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer YOUR_TOKEN_HERE

Body:

{
  "connectionId": "YOUR_CONNECTION_ID",
  "method": "sendMessage",
  "params": [
    "[email protected]",
    {
      "text": "Hi! This was sent using Whats2API"
    }
  ]
}

Response

Use the result field on success. The error boolean indicates success/failure.

{
  "error": false,
  "result": {
    "messageStubParameters": [],
    "labels": [],
    "userReceipt": [],
    "reactions": [],
    "pollUpdates": [],
    "key": {
      "remoteJid": "[email protected]",
      "fromMe": true,
      "id": "THE_MESSAGE_ID"
    },
    "message": {
      "extendedTextMessage": {
        "text": "Hi! This was sent using Whats2API"
      }
    },
    "messageTimestamp": {
      "low": 1702671627,
      "high": 0,
      "unsigned": true
    },
    "status": 1
  }
}

WAMessage shape returned by Baileys `sendMessage`.

Save the message ID — you'll use it to delete, react, quote, and reply.

More examples and methods

There's a lot which can be done using your connection, here's the list of all the methods, with their parameters.