Sending Messages
Please note that Sandbox references only send text and with an additional URL.
The following lists examples of message sending. These are always done by a POST call to the /chats/send endpoint, passing the reference number from which the message is sent as an id parameter. In the request body, the mobile number that receives the message and the message itself are defined.
Text
To send a text message, the text is specified in the "message" field.
Example:
curl --location --request POST 'https://apirest.whatsuy.com/chats/send?id=11111111'
--header 'Authorization: Bearer <token>'
--header 'Content-Type: application/json'
--data-raw '{
"receiver": "59891111112",
"message": {
"text": "Test Message"
}
}'
Image
To send an image, the image URL is provided in the "image" field. You can also add a caption to the image.
Example:
curl --location --request POST 'https://apirest.whatsuy.com/chats/send?id=11111111'
--header 'Authorization: Bearer <token>'
--header 'Content-Type: application/json'
--data-raw '{
"receiver": "59891111112",
"message": {
"image": {
"url": "https://static.whatsuy.com/wu-logo.png"
},
"caption": "Image test"
}
}'
Video
To send a video, the video URL is provided in the "video" field. As with images, you can also add a caption to the video.
Example:
curl --location --request POST 'https://apirest.whatsuy.com/chats/send?id=11111111'
--header 'Authorization: Bearer <token>'
--header 'Content-Type: application/json'
--data-raw '{
"receiver": "59891111112",
"message": {
"video": {
"url": "https://static.whatsuy.com/wu-intro.mp4"
},
"caption": "Video test"
}
}'
Document
To send a document, the document URL is provided in the "document" field. You can also add a filename and a caption to the document.
Example:
curl --location --request POST 'https://apirest.whatsuy.com/chats/send?id=11111111'
--header 'Authorization: Bearer <token>'
--header 'Content-Type: application/json'
--data-raw '{
"receiver": "59891111112",
"message": {
"document": {
"url": "https://static.whatsuy.com/example.pdf"
},
"fileName" :"PDF Name",
"caption": "Document test"
}
}'
Buttons
To send a message with buttons, provide the text, buttons, and other fields in the "message" field.
Example:
curl --location --request POST 'https://apirest.whatsuy.com/chats/send?id=11111111'
--header 'Authorization: Bearer <token>'
--header 'Content-Type: application/json'
--data-raw '{
"receiver": "59891111112",
"message": {
"text": "Test Buttons",
"headerType": 1,
"footer": "https://whatsuy.com",
"buttons": [
{
"buttonId": "btn1",
"buttonText": {
"displayText": "Btn 1"
}
},
{
"buttonId": "btn2",
"buttonText": {
"displayText": "Btn 2"
}
},
{
"buttonId": "btn3",
"buttonText": {
"displayText": "Btn 3"
}
}
]
}
}'
List
To send a list of options, provide the title, text, footer, button text, and sections fields in the "message" field.
Example:
curl --location --request POST 'https://apirest.whatsuy.com/chats/send?id=11111111'
--header 'Authorization: Bearer <token>'
--header 'Content-Type: application/json'
--data-raw '{
"receiver": "59891111112",
"message": {
"title": "Choose an option",
"text": "This option will determine the course of the communication",
"footer": "Whats UY",
"buttonText": "View options",
"sections": [
{
"title": "Linear Path",
"rows": [
{
"title": "Go along the sidewalk",
"rowId": "op1"
},
{
"title": "Go along the street",
"rowId": "op2",
"description": "This is the right choice"
}
]
},
{
"title": "Chaotic Path",
"rows": [
{
"title": "Jump between cars",
"rowId": "op3",
"description": "Not recommended"
},
{
"title": "Go along the curb",
"rowId": "op4",
"description": "Playful"
}
]
}
]
}
}'
Standard Response
Regardless of the type of message sent (text, image, video, document, buttons, or list), the standard response will be as follows:
{
"success": true,
"message": "The message has been successfully sent.",
"data": {
"key": {
"remoteJid": "59891111112@s.whatsapp.net",
"fromMe": true,
"id": "CAE5TY3FD3131E96"
},
"status": "PENDING"
}
}
This indicates that the message has been successfully sent and is pending delivery.