Whatsapp-web.js: Template messages with Buttons

Created on 7 Feb 2020  路  7Comments  路  Source: pedroslopez/whatsapp-web.js

image

image

https://wa.me/5511955705173?text=Ol%C3%A1,%20UAM

image

is there any possibility and implementation of this function?

enhancement

Most helpful comment

Any further developments? Really excited to get this one!

All 7 comments

Nice one. I will look into it.

in another project here at git, some progress has been made with this type of message. But it seems that whatsapp blocks when it is sent to.

https://github.com/smashah/sulla/blob/82ee145b9d83222aa506ff3bfc72a9aacd9164da/src/lib/wapi.js#L1692

Oh wow this is really interesting. Will definitely look In to this as well!

template_button.txt

[
{
"id": {
"fromMe": false,
"remote": "[email protected]",
"id": "91875E65606A66D4EA",
"_serialized": "[email protected]_91875E65606A66D4EA"
},
"body": "Confirma para mim o seu nome completo: menu principal, est谩 correto(a)?",
"type": "template",
"subtype": "text",
"t": 1580956051,
"notifyName": "",
"from": "[email protected]",
"to": "[email protected]",
"self": "in",
"ack": 0,
"invis": true,
"star": false,
"caption": "Confirma para mim o seu nome completo: menu principal, est谩 correto(a)?",
"broadcast": false,
"mentionedJidList": [],
"buttons": [
{
"id": "0",
"displayText": "Sim, est谩 correto(a)",
"subtype": "quick_reply",
"selectionId": "{\"eventName\":\"yes\"}"
},
{
"id": "1",
"displayText": "N茫o, quero corrigir",
"subtype": "quick_reply",
"selectionId": "{\"eventName\":\"no\"}"
}
],
"isForwarded": false,
"labels": []
},
{
"id": {
"fromMe": false,
"remote": "[email protected]",
"id": "96BA2DB14292993A26",
"_serialized": "[email protected]_96BA2DB14292993A26"
},
"body": "Para continuar precisamos de algumas informa莽玫es.\nGostaria de informar os dados ou enviar uma foto da CNH/RG e n贸s coletamos os dados da imagem da CNH/RG?",
"type": "template",
"subtype": "text",
"t": 1580944973,
"notifyName": "",
"from": "[email protected]",
"to": "[email protected]",
"self": "in",
"ack": 0,
"invis": true,
"star": false,
"caption": "Para continuar precisamos de algumas informa莽玫es.\nGostaria de informar os dados ou enviar uma foto da CNH/RG e n贸s coletamos os dados da imagem da CNH/RG?",
"broadcast": false,
"mentionedJidList": [],
"buttons": [
{
"id": "0",
"displayText": "Informar dados",
"subtype": "quick_reply",
"selectionId": "{\"eventName\":\"inform\"}"
},
{
"id": "1",
"displayText": "Enviar foto RG",
"subtype": "quick_reply",
"selectionId": "{\"eventName\":\"event-rg\"}"
},
{
"id": "2",
"displayText": "Enviar foto CNH",
"subtype": "quick_reply",
"selectionId": "{\"eventName\":\"event-cnh\"}"
}
],
"isForwarded": false,
"labels": []
},
{
"id": {
"fromMe": true,
"remote": "[email protected]",
"id": "3EB023CE6F1611ADA489",
"_serialized": "[email protected]_3EB023CE6F1611ADA489"
},
"body": "Informar dados",
"type": "template_button_reply",
"t": 1580945117,
"notifyName": "",
"from": "[email protected]",
"to": "[email protected]",
"self": "in",
"ack": 2,
"invis": true,
"star": false,
"quotedMsg": {
"type": "chat",
"body": "Para continuar precisamos de algumas informa莽玫es.\nGostaria de informar os dados ou enviar uma foto da CNH/RG e n贸s coletamos os dados da imagem da CNH/RG?"
},
"quotedStanzaID": "96BA2DB14292993A26",
"quotedParticipant": "[email protected]",
"mentionedJidList": [],
"selectedId": "{\"eventName\":\"inform\"}",
"selectedIndex": 0,
"labels": []
},
{
"id": {
"fromMe": true,
"remote": "[email protected]",
"id": "3EB092A0BDF2B11FFF60",
"_serialized": "[email protected]_3EB092A0BDF2B11FFF60"
},
"body": "Enviar foto RG",
"type": "template_button_reply",
"t": 1580956019,
"notifyName": "",
"from": "[email protected]",
"to": "[email protected]",
"self": "in",
"ack": 2,
"invis": true,
"star": false,
"quotedMsg": {
"type": "chat",
"body": "Para continuar precisamos de algumas informa莽玫es.\nGostaria de informar os dados ou enviar uma foto da CNH/RG e n贸s coletamos os dados da imagem da CNH/RG?"
},
"quotedStanzaID": "96BA2DB14292993A26",
"quotedParticipant": "[email protected]",
"mentionedJidList": [],
"selectedId": "{\"eventName\":\"event-rg\"}",
"selectedIndex": 1,
"labels": []
}
]

Any further developments? Really excited to get this one!

I would love to have this!

Those messages with buttons looks awesome! Hope we can use that in this library in the future!

Edit:
As said on open-wa library, this feature is impossible to have at the moment, because it needs WhatsApp Oficial API (paid) to use those buttons, so its a feature that whatsapp doesn't permit normal business users to use, only those business accounts that pay alot of money to have the official api.
https://github.com/open-wa/wa-automate-nodejs/issues/98

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felipemm picture felipemm  路  5Comments

fdciabdul picture fdciabdul  路  6Comments

iamshouvikmitra picture iamshouvikmitra  路  4Comments

franciscol99 picture franciscol99  路  3Comments

dedenhendrap picture dedenhendrap  路  8Comments