Error sending SendButtons with a button type different from "reply"
Welcome!
- [x] Yes, I have searched for similar issues on GitHub and found none.
What did you do?
I tried to send a SendButtons request connected to the Official WhatsApp API. The request contained a button of type "url" instead of "reply".
{
"number": "{{ remoteJid }}",
"title": "Title Button",
"description": "Description Button",
"footer": "Footer Button",
"buttons": [
{
"type": "url",
"displayText": "Google",
"url": "https://google.com"
}
]
}
What did you expect?
I expected it to return a message with a button that redirects to the selected link
What did you observe instead of what you expected?
The API returned a 400 Bad Request error with the following message:
{
"status": 400,
"error": "Bad Request",
"response": {
"message": [
"TypeError: Cannot read properties of undefined (reading '0')"
]
}
}
Screenshots/Videos
No response
Which version of the API are you using?
Version Evolution API: v2.2.3
What is your environment?
Linux
Other environment specifications
No response
If applicable, paste the log output
[Evolution API] [InstanceName] v2.2.3 198 - Mon Feb 17 2025 14:54:51 ERROR [ChannelStartupService] [object]
TypeError: Cannot read properties of undefined (reading '0')
at ls.sendMessageWithTyping (/evolution/dist/main.js:221:479)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ls.buttonMessage (/evolution/dist/main.js:221:3908)
at async ss.sendButtons (/evolution/dist/main.js:2:23571)
at async fn.dataValidate (/evolution/dist/main.js:286:62716)
at async /evolution/dist/main.js:286:128206
Additional Notes
No response
Same here:
request
{ "number": "{{ remoteJid }}", "title": "Title Button", "description": "Description Button", "footer": "Footer Button", "buttons": [ { "type": "url", "displayText": "Google", "url": "https://google.com" } ] }
response:
400 - { "status": 400, "error": "Bad Request", "response": { "message": [ ["instance requires property \\\"text\\\" "]] } }
The payload format being sent is incorrect.
Below is an example of the API in the Evolution documentation.
{
"number": "{{remoteJid}}",
"title": "Title Button",
"description": "Description Button",
"footer": "Footer Button",
"buttons": [
{
"type": "reply",
"displayText": "Teste Button",
"id": "123"
}
// {
// "type": "copy",
// "displayText": "Copia Código",
// "copyCode": "ZXN0ZSDDqSB1bSBjw7NkaWdvIGRlIHRleHRvIGNvcGnDoXZlbC4="
// },
// {
// "type": "url",
// "displayText": "Evolution API",
// "url": "http://evolution-api.com"
// },
// {
// "type": "call",
// "displayText": "Me ligue",
// "phoneNumber": "557499879409"
// }
// {
// "type": "pix",
// "currency": "BRL",
// "name": "Davidson Gomes",
// "keyType": "random", /* phone, email, cpf, cnpj, random */
// "key": "0ea59ac5-f001-4f0e-9785-c772200f1b1e"
// }
]
// options
// "delay": 1200,
// "quoted": {
// // payload message or key.id only for get message in database
// "key": {
// "id": " MESSAGE_ID"
// },
// "message": {
// "conversation": "CONTENT_MESSAGE"
// }
// },
// "mentionsEveryOne": false,
// "mentioned": [
// "{{remoteJid}}"
// ]
}
However, it's worth noting that sending buttons isn't working for QR Code accounts.
I don't know if this is temporary or permanent.
Hello. From what I read in the code, it's a routing error for the Facebook API.
Has anyone been able to find a solution? I can't receive them.
Meta changed one of the ways that buttons are sent with other types, it would have to be a developer hahaha