Tombol Interaktif & List
Kirim pesan dengan tombol Quick Reply, CTA URL/Call/Copy, List, dan Carousel
NgirimWA mendukung berbagai jenis tombol interaktif WhatsApp. Endpoint paling sederhana adalah POST /messages/quick-reply yang memakai DSL ramah developer. Untuk kebutuhan lanjutan tersedia juga endpoint low-level, list, dan carousel.
Base URL
https://dash.ngirimwa.com/api/v1Headers (semua endpoint)
x-api-key: API_KEY_ANDA
Content-Type: application/json
Idempotency-Key: <uuid-unik-per-request>
Idempotency-Keymencegah pesan terkirim ganda saat retry. Lihat Autentikasi → Idempotency-Key.
Batasan Global (mengikuti WhatsApp)
| Komponen | Batas |
|---|---|
Tombol per pesan (quick-reply, buttons, interactive) | Max 3 |
| Tombol per kartu carousel | Max 3 |
| Kartu carousel | Max 10 |
| Section list | Max 10 |
| Row per section list | Max 10 |
Teks tombol (text / displayText) | ~20 karakter |
| Title / Header text | ~60 karakter |
| Footer | ~60 karakter |
Body (text) | ~1.024 karakter (ada media) atau ~4.096 (tanpa media) |
| Title row list | ~24 karakter |
| Description row list | ~72 karakter |
Limit di atas adalah display limit WhatsApp — pesan yang melewati batas tetap terkirim tapi mungkin terpotong di layar penerima.
Quick Reply (Rekomendasi)
Cara termudah untuk kirim pesan dengan tombol. Satu endpoint mendukung 4 jenis tombol sekaligus: reply, url, call, copy.
Endpoint
POST /messages/quick-replyRequest — Tombol Balasan Sederhana
{
"to": "628123456789",
"text": "Mau lanjut order?",
"footer": "Tim NgirimWA",
"buttons": [
{ "kind": "reply", "text": "Ya, lanjut", "id": "yes" },
{ "kind": "reply", "text": "Tidak", "id": "no" }
]
}Request — Campuran Reply + URL + Call
{
"to": "628123456789",
"title": "Konfirmasi Pesanan",
"text": "Pesanan ORD-12345 sudah kami siapkan.",
"footer": "Toko XYZ",
"image": { "url": "https://domain-anda.com/banner.jpg" },
"buttons": [
{ "kind": "reply", "text": "Konfirmasi", "id": "confirm_12345" },
{ "kind": "url", "text": "Lihat invoice", "url": "https://domain-anda.com/inv/12345" },
{ "kind": "call", "text": "Telepon CS", "phone": "62811223344" }
]
}Request — Tombol Salin Kode (Voucher / Coupon)
{
"to": "628123456789",
"text": "Selamat! Voucher diskon 20% untuk Anda.",
"buttons": [
{ "kind": "copy", "text": "Salin kode", "code": "PROMO20" }
]
}Parameter Body
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
to | string | ✅ | Nomor telepon penerima |
text | string | ✅ | Isi pesan utama |
title | string | ❌ | Judul pesan (di atas teks) |
subtitle | string | ❌ | Sub-judul |
footer | string | ❌ | Footer bergaya WhatsApp |
image | object | ❌ | { url } atau { base64, mimeType } |
buttons | array | ✅ | 1–3 tombol |
Tipe Tombol (kind)
kind | Field tambahan | Fungsi |
|---|---|---|
reply | id (opsional) | Tombol balasan cepat — saat ditekan, ID tombol dikirim balik |
url | url (wajib) | Membuka URL di browser |
call | phone (wajib) | Memulai panggilan ke nomor |
copy | code (wajib) | Menyalin kode ke clipboard penerima |
Batasan WhatsApp: Maksimal 3 tombol per pesan. Kombinasi jenis bebas.
Respon Sukses
{
"success": true,
"message": "Quick-reply message sent successfully"
}Contoh cURL
curl -X POST https://dash.ngirimwa.com/api/v1/messages/quick-reply \
-H "x-api-key: API_KEY_ANDA" \
-H "Content-Type: application/json" \
-d '{
"to": "628123456789",
"text": "Pilih jenis pengiriman:",
"buttons": [
{ "kind": "reply", "text": "Reguler", "id": "ship_reg" },
{ "kind": "reply", "text": "Express", "id": "ship_exp" },
{ "kind": "url", "text": "Tarif", "url": "https://domain-anda.com/tarif" }
]
}'Buttons Sederhana (Legacy)
Endpoint legacy untuk pesan dengan 1–3 tombol reply. Untuk fitur baru kami sarankan pakai quick-reply di atas.
Endpoint
POST /messages/buttonsRequest
{
"to": "628123456789",
"text": "Apakah Anda puas dengan layanan kami?",
"footer": "Berikan rating dengan menekan tombol",
"buttons": [
{ "buttonId": "rate_5", "displayText": "⭐⭐⭐⭐⭐ Sangat Puas" },
{ "buttonId": "rate_3", "displayText": "⭐⭐⭐ Cukup" },
{ "buttonId": "rate_1", "displayText": "⭐ Kurang" }
]
}| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
to | string | ✅ | Nomor penerima |
text | string | ✅ | Isi pesan |
footer | string | ❌ | Footer |
buttons | array | ✅ | 1–3 tombol, masing-masing { buttonId, displayText } |
Interactive (Low-Level)
Untuk integrator yang butuh kontrol penuh atas struktur Baileys. Memakai shape name + params (sama persis dengan WhatsApp Cloud API style).
Endpoint
POST /messages/interactiveRequest
{
"to": "628123456789",
"text": "Ada yang bisa kami bantu?",
"footer": "NgirimWA Support",
"image": { "url": "https://domain-anda.com/logo.png" },
"buttons": [
{ "name": "quick_reply", "params": { "display_text": "Tanya", "id": "ask" } },
{ "name": "cta_url", "params": { "display_text": "Web", "url": "https://ngirimwa.com", "merchant_url": "https://ngirimwa.com" } }
]
}name yang didukung | Params utama |
|---|---|
quick_reply | display_text, id |
cta_url | display_text, url, merchant_url |
cta_call | display_text, phone_number |
cta_copy | display_text, copy_code |
Endpoint
quick-replydi atas adalah pembungkus ergonomis dari endpoint ini. Pakai itu kecuali Anda butuh field bawah-permukaan.
List Message
Pesan dengan menu dropdown bersection — ideal untuk katalog produk, FAQ, atau menu pilihan banyak.
Endpoint
POST /messages/listRequest
{
"to": "628123456789",
"text": "Pilih kategori produk yang Anda cari:",
"title": "Katalog Toko",
"footer": "Tim NgirimWA",
"buttonText": "Pilih kategori",
"sections": [
{
"title": "Elektronik",
"rows": [
{ "title": "Laptop", "rowId": "cat_laptop", "description": "Laptop & aksesoris" },
{ "title": "Smartphone", "rowId": "cat_phone", "description": "HP & aksesoris" }
]
},
{
"title": "Fashion",
"rows": [
{ "title": "Pakaian Pria", "rowId": "cat_male", "description": "Kemeja, kaos, celana" },
{ "title": "Pakaian Wanita", "rowId": "cat_female", "description": "Dress, blouse, rok" }
]
}
]
}Parameter
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
to | string | ✅ | Nomor penerima |
text | string | ✅ | Isi pesan |
buttonText | string | ✅ | Label tombol pembuka list |
sections | array | ✅ | 1+ section, tiap section punya rows |
title / footer | string | ❌ | Header / footer |
Setiap row: { title, rowId, description? }. rowId yang dikembalikan saat user memilih.
Carousel (Banyak Kartu)
Pesan dengan beberapa kartu yang bisa di-swipe oleh penerima. Maksimal 10 kartu, tiap kartu boleh punya 3 tombol sendiri.
Endpoint
POST /messages/carouselRequest
{
"to": "628123456789",
"text": "Cek produk terbaru kami:",
"cards": [
{
"image": { "url": "https://domain-anda.com/produk1.jpg" },
"title": "Sepatu Sport",
"body": "Ringan, nyaman, harga Rp 350.000",
"buttons": [
{ "name": "cta_url", "params": { "display_text": "Beli", "url": "https://domain-anda.com/p/1", "merchant_url": "https://domain-anda.com/p/1" } }
]
},
{
"image": { "url": "https://domain-anda.com/produk2.jpg" },
"title": "Tas Ransel",
"body": "Tahan air, kapasitas 30L",
"buttons": [
{ "name": "quick_reply", "params": { "display_text": "Info detail", "id": "info_bag_2" } }
]
}
]
}Parameter
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
to | string | ✅ | Nomor penerima |
text | string | ✅ | Header pesan di atas carousel |
cards | array | ✅ | 1–10 kartu |
Per kartu: image / video, title, body, footer, dan buttons (max 3) dengan shape low-level (lihat tabel di Interactive).
Tips & Best Practices
Gunakan quick-reply untuk hampir semua kebutuhan. DSL-nya lebih sederhana, jenis tombol langsung ekspresif, dan internal-nya tetap memakai shape yang sama dengan endpoint low-level.
Footer hanya muncul jika tombol ada. Footer-style WhatsApp memerlukan komponen interactive, jadi pesan teks biasa tidak menampilkan footer.
Tombol reply mengirim balik id ke webhook. Anda menangkap event message.received dengan type: 'buttons_response' dan field selected_id sama dengan id tombol yang dikirim.
Gambar/video di header bersifat opsional — tapi sangat meningkatkan click-through rate. Pakai URL HTTPS publik (sistem akan unduh & re-upload ke WhatsApp).