Add support for buttons message (#584)

* Add list message example

* New protobuf extracted by @tulir

It now supported sending for buttonsMessage

* New protobuf by @tulir

* Added support for buttons message

* Sorry i am sleepy.....

* Sorry my typo :3

* just tidying up
This commit is contained in:
Ryn's
2021-07-13 20:02:27 +08:00
committed by GitHub
parent e40b2f98a6
commit 3ce4f6cc6e
6 changed files with 42558 additions and 6306 deletions

View File

@@ -231,6 +231,36 @@ const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
+ 'TEL;type=CELL;type=VOICE;waid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
+ 'END:VCARD'
const sentMsg = await conn.sendMessage(id, {displayname: "Jeff", vcard: vcard}, MessageType.contact)
// send a list message!
const rows = [
{title: 'Row 1', description: "Hello it's description 1", rowId:"rowid1"},
{title: 'Row 2', description: "Hello it's description 2", rowId:"rowid2"}
]
const sections = [{title: "Section 1", rows: rows}]
const button = {
buttonText: 'Click Me!',
description: "Hello it's list message",
sections: sections
}
const sendMsg = await conn.sendMessage(id, button, MessageType.listMessage)
// send a buttons message!
const buttons = [
{buttonId: 'id1', buttonText: {displayText: 'Button 1'}, type: 1},
{buttonId: 'id2', buttonText: {displayText: 'Button 2'}, type: 1}
]
const buttonMessage = {
contentText: "Hi it's button message",
footerText: 'Hello World',
buttons: buttons,
headerType: 1
}
const sendMsg = await conn.sendMessage(id, buttonMessage, MessageType.buttonsMessage)
```
### Media Messages