Stable button & list builder for Baileys WhatsApp bot
npm install wabot-buttonStable button & list builder untuk Baileys WhatsApp bot.
Mendukung Template Buttons, List Messages, dan CTA Buttons.
Dibuat untuk CommonJS (CJS), siap pakai di bot WhatsApp berbasis Baileys.
---
```bash
npm install wabot-button
---
š§© Fitur
Button Builder ā Quick Reply, URL, Call
List Message Builder ā Sectioned list messages
Template Builder ā Semua jenis template buttons resmi
Send Adapter ā Kirim ke Baileys langsung
CJS Compatible ā import dengan require
---
š¹ Import Module (CJS)
const { Button, List, Template, send } = require('wabot-button')
---
1ļøā£ Button Builder
Buat button interaktif:
const buttonMessage = new Button("Halo, pilih opsi:")
.reply("menu", "Menu")
.url("Website", "https://example.com")
.call("Call", "628123456789")
.build()
await send(sock, jid, buttonMessage)
.reply(id, text) ā Quick reply button
.url(text, url) ā Button buka website
.call(text, number) ā Button call phone
---
2ļøā£ List Message Builder
const listMessage = new List("Pilih menu utama", "Footer optional")
.section("Main Menu", [
{ title: "Menu 1", rowId: "menu1" },
{ title: "Menu 2", rowId: "menu2" }
])
.section("Lainnya", [
{ title: "Info", rowId: "info" }
])
.build("Pilih")
await send(sock, jid, listMessage)
.section(title, rows) ā tambah section
.build(buttonText) ā finalize list message
Max 5 sections, max 10 rows per section
---
3ļøā£ Template Builder (Official Buttons)
const templateMessage = new Template("Halo, pilih:")
.quickReply("Menu", "menu")
.url("Website", "https://example.com")
.call("Call", "628123456789")
.build()
await send(sock, jid, templateMessage)
.quickReply(text, id) ā Quick reply button
.url(text, url) ā URL button resmi
.call(text, number) ā Call button resmi
---
4ļøā£ Send Adapter
await send(sock, jid, message, { quoted: m })
sock ā instance Baileys
jid ā nomor / chat id
message ā hasil .build()
options ā optional { quoted: msg }
---
š¹ Contoh Lengkap
const { Button, List, Template, send } = require('wabot-button')
// Quick reply button
const buttons = new Button("Hai, pilih:")
.reply("menu", "Menu")
.url("Website", "https://example.com")
.call("Call", "628123456789")
.build()
// List message
const listMsg = new List("Main Menu", "Footer")
.section("Menu Utama", [
{ title: "Profile", rowId: "profile" },
{ title: "Settings", rowId: "settings" }
])
.build("Pilih")
// Template official
const templateMsg = new Template("Pilih opsi:")
.quickReply("Menu", "menu")
.url("Website", "https://example.com")
.call("Call", "628123456789")
.build()
await send(sock, jid, buttons)
await send(sock, jid, listMsg)
await send(sock, jid, templateMsg)
---
š Tips & Limit
Button JSON ā semi-official, bisa break kalau WA update
Template Buttons ā official, aman untuk bot publik
List Messages ā max 5 sections, max 10 rows per section
Gunakan send(sock, jid, message) untuk semua jenis pesan
---
š Keywords
WhatsApp Bot
Baileys
Buttons
List Messages
Template Messages
CJS
---
ā” License
MIT License