wabot-button
v1.0.6
Published
Stable button & list builder for Baileys WhatsApp bot
Readme
Wabot Button
Stable 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.
📦 Install
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