Non-Media Messages
Messages without media. Read the details of how to use it in Requests.
There's a lib for nodejs here: Click here
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.
- Send a simple text!
{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "text": "Hi! This was sent using Whats2API" } ] } - Send a reply message!
{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "text": "Hi! This was sent using Whats2API" }, { "quoted": "MESSAGE_OBJECT_TO_BE_QUOTED" } ] } - Send a mentions message!
{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "text": "Hi! I will mention @1234567890" }, { "mentions": [ "[email protected]" ] } ] } - Send a location!
{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "location": { "degreesLatitude": 24.121231, "degreesLongitude": 55.1121221 } } ] } - Send a contact (vCard):
{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "contacts": { "displayName": "Jeff", "contacts": [ { "vcard": "BEGIN:VCARD\nVERSION:3.0\nFN:Jeff Singh\nORG:Ashoka Uni;\nTEL;type=CELL;type=VOICE;waid=911234567890:+91 12345 67890\nEND:VCARD" } ] } } ] } - Send a reaction!
{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "react": { "text": "💖", "key": "MESSAGE_KEY_WHICH_YOU_RECEIVED_THROUGH_EVENTS" } } ] } - Send a buttons message!
WhatsApp fault: may not work at all times.{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "text": "Hi it's button message", "footer": "Hello World", "buttons": [ { "buttonId": "id1", "buttonText": { "displayText": "Button 1" }, "type": 1 }, { "buttonId": "id2", "buttonText": { "displayText": "Button 2" }, "type": 1 }, { "buttonId": "id3", "buttonText": { "displayText": "Button 3" }, "type": 1 } ], "headerType": 1 } ] } - Send a template message!
WhatsApp fault: may not work at all times.{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "text": "Hi it's a template message", "footer": "Hello World", "templateButtons": [ { "index": 1, "urlButton": { "displayText": "Checkout whats2api!", "url": "https://whats2api.com" } }, { "index": 2, "callButton": { "displayText": "Call me!", "phoneNumber": "+1 (234) 5678-901" } }, { "index": 3, "quickReplyButton": { "displayText": "This is a reply, just like normal buttons!", "id": "id-like-buttons-message" } } ] } ] } - Send a list!
WhatsApp fault: may not work at all times.{ "connectionId": "YOUR_CONNECTION_ID", "method": "sendMessage", "params": [ "[email protected]", { "text": "This is a list", "footer": "nice footer, link: https://google.com", "title": "Amazing boldfaced list title", "buttonText": "Required, text on the button to view the list", "sections": [ { "title": "Section 1", "rows": [ { "title": "Option 1", "rowId": "option1" }, { "title": "Option 2", "rowId": "option2", "description": "This is a description" } ] }, { "title": "Section 2", "rows": [ { "title": "Option 3", "rowId": "option3" }, { "title": "Option 4", "rowId": "option4", "description": "This is a description V2" } ] } ] } ] }