mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
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:
30
README.md
30
README.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user