Baileys
Baileys copied to clipboard
Simple quick reply button error [BUG]
Now a simple button message don't work.
Only WhatsApp Web.
const 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}
]
const buttonMessage = {
text: "Hi it's button message",
footer: 'Hello World',
buttons: buttons,
headerType: 1
}
const sendMsg = await sock.sendMessage(msg.key.remoteJid!, buttonMessage)
@adiwajshing
This way works on IOS but don't work on web
try remove footer
const 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}
]
const buttonMessage = {
text: "Hi it's button message",
// footer: 'Hello World',
buttons: buttons,
headerType: 1
}
const sendMsg = await sock.sendMessage(msg.key.remoteJid!, buttonMessage)
It returns an empty string... I'm away from my computer now to test on web.
try send this object
{
"text": "Hi it's button message",
"buttons": [
{"buttonId": "id1", "buttonText": {"displayText": "Button 1"}},
{"buttonId": "id2", "buttonText": {"displayText": "Button 2"}},
{"buttonId": "id3", "buttonText": {"displayText": "Button 3"}}
]
}
try remove footer
const 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} ] const buttonMessage = { text: "Hi it's button message", // footer: 'Hello World', buttons: buttons, headerType: 1 } const sendMsg = await sock.sendMessage(msg.key.remoteJid!, buttonMessage)
Work fine!!! What's happening? Before it worked with the footer.
Also try with empty footer like
const buttonMessage = {
text: "Hi it's button message",
footer: '',
buttons: buttons,
headerType: 1
}
I also have this issue removing footer works.
This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days