WhatsApp reply buttons
Reply buttons WhatsApp मैसेज के नीचे तीन तक टैप करने योग्य विकल्प रखते हैं, ताकि प्राप्तकर्ता फ्री टेक्स्ट की जगह एक टैप से जवाब दे सके। इन्हें किसी त्वरित निर्णय के लिए इस्तेमाल करें, जैसे बुकिंग की पुष्टि या रद्दीकरण। तीन से ज़्यादा विकल्पों के लिए इसके बजाय लिस्ट मेन्यू का उपयोग करें।
Reply buttons भेजें
interactive.type को button पर सेट करें, एक body_text और एक से तीन buttons के साथ, हर एक quick_reply:
const msg = await bird.whatsapp.send({
to: "+16505551234",
from: "+13124495648",
interactive: {
type: "button",
body_text: "Your gardening workshop is scheduled for 9am tomorrow.",
buttons: [{ type: "quick_reply", quick_reply: { slug: "change-booking", text: "Change" } }],
},
});
console.log(msg.id, msg.status);msg = client.whatsapp.send(
to="+16505551234",
from_="+13124495648",
interactive={
"type": "button",
"body_text": "Your gardening workshop is scheduled for 9am tomorrow.",
"buttons": [{"type": "quick_reply", "quick_reply": {"slug": "change-booking", "text": "Change"}}],
},
)
print(msg.id, msg.status)package main
import (
"context"
"fmt"
"log"
"os"
bird "github.com/messagebird/bird-sdk-go"
"github.com/messagebird/bird-sdk-go/option"
)
func main() {
client, err := bird.NewClient(option.WithAPIKey(os.Getenv("BIRD_API_KEY")))
if err != nil {
log.Fatal(err)
}
msg, err := client.Whatsapp.Send(context.Background(), bird.WhatsappSendParams{
To: "+16505551234",
From: "+13124495648",
Interactive: &bird.WhatsAppInteractiveSend{
Type: "button",
BodyText: "Your gardening workshop is scheduled for 9am tomorrow.",
Buttons: &[]bird.WhatsAppInteractiveButtonSend{
{Type: "quick_reply", QuickReply: &bird.WhatsAppInteractiveQuickReplyButtonSend{Slug: "change-booking", Text: "Change"}},
},
},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(msg.Id, *msg.Status)
}$interactive = (new WhatsAppMessageSendRequestInteractive())
->setType('button')
->setBodyText('Your gardening workshop is scheduled for 9am tomorrow.')
->setButtons([
(new WhatsAppInteractiveButtonSend())
->setType('quick_reply')
->setQuickReply((new WhatsAppInteractiveButtonSendQuickReply())->setSlug('change-booking')->setText('Change')),
]);
$message = $bird->whatsapp->send(
to: '+16505551234',
from: '+13124495648',
interactive: $interactive,
);
echo $message->getId(), ' ', $message->getStatus();bird whatsapp send \
--from +13124495648 \
--interactive '{"body_text":"Your gardening workshop is scheduled for 9am tomorrow.","buttons":[{"quick_reply":{"slug":"change-booking","text":"Change"},"type":"quick_reply"}],"type":"button"}' \
--to +16505551234curl -X POST "https://{region}.platform.bird.com/v1/whatsapp/messages" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+16505551234",
"from": "+13124495648",
"interactive": {
"type": "button",
"body_text": "Your gardening workshop is scheduled for 9am tomorrow.",
"buttons": [
{ "type": "quick_reply", "quick_reply": { "slug": "change-booking", "text": "Change" } }
]
}
}'from हर service मैसेज पर ज़रूरी है: आपके वर्कस्पेस का अपना नंबर, Bird-managed नहीं। पूर्ण संरचना में एक वैकल्पिक हेडर, फ़ुटर, पहले के मैसेज का कोट, और एक दूसरा बटन जुड़ता है:
{
"to": "+16505551234",
"from": "+13124495648",
"in_reply_to_message_id": "wam_01kya19eknftrs2s6p82asmvnh",
"interactive": {
"type": "button",
"header": {
"type": "image",
"url": "https://cdn.example.com/banners/workshop.png"
},
"body_text": "Your gardening workshop is scheduled for 9am tomorrow.",
"footer_text": "Lucky Shrub, your gateway to succulents",
"buttons": [
{ "type": "quick_reply", "quick_reply": { "slug": "change-booking", "text": "Change" } },
{ "type": "quick_reply", "quick_reply": { "slug": "cancel-booking", "text": "Cancel" } }
]
},
"tags": [{ "name": "category", "value": "booking" }],
"metadata": { "order_id": "A-1" }
}in_reply_to_message_id उसी conversation में पहले के किसी मैसेज को कोट करता है। रिज़ॉल्यूशन कैसे काम करता है और क्या छूट सकता है, इसके लिए hub का रिप्लाई को सहसंबंधित करने के लिए मैसेज कोट करना देखें।
यह type केवल quick_reply बटन भेजता है। एक cta_url बटन एक अलग interactive.type का हिस्सा है और buttons के साथ नहीं आ सकता; साझा बटन संरचना के लिए hub का buttons सेक्शन देखें।
हेडर और फ़ुटर
हेडर वैकल्पिक है, और यह चार में से एक आकार का होता है:
"header": { "type": "text", "text": "New workshop dates" }
"header": { "type": "image", "url": "https://cdn.example.com/a.png" }
"header": { "type": "video", "url": "https://cdn.example.com/a.mp4" }
"header": { "type": "document", "url": "https://cdn.example.com/a.pdf" }एक मीडिया हेडर (image, video, या document) अपनी फ़ाइल को एक पब्लिक https URL के रूप में रखता है जिसे WhatsApp भेजते समय fetch करता है, न कि अपलोड किए गए मीडिया हैंडल के रूप में। footer_text वैकल्पिक है और बटन के नीचे एक लाइन जोड़ता है।
सीमाएँ
| फ़ील्ड | सीमा |
|---|---|
buttons | 1 से 3 entries, हर एक quick_reply |
quick_reply.slug | ज़रूरी, 1 से 256 characters |
quick_reply.text (label) | ज़रूरी, 1 से 20 characters, मैसेज में अद्वितीय |
body_text | ज़रूरी, 1 से 1,024 characters |
footer_text | वैकल्पिक, 1 से 60 characters |
header.text | 1 से 60 characters |
Bird जाँचता है कि बटन labels (quick_reply.text) अद्वितीय हैं, लेकिन यह नहीं जाँचता कि slug values अद्वितीय हैं, भले ही हर slug का उद्देश्य एक बटन की पहचान करना हो। एक ही slug वाले दो बटन दोनों भेजे और डिलीवर होते हैं, और उनके रिप्लाई अलग-अलग नहीं पहचाने जा सकते।
रिप्लाई पढ़ना
एक प्रेस अपने आप में एक inbound मैसेज के रूप में आती है, जिसमें interactive_reply होता है:
{
"id": "wam_01kyb2m4xq7whs0d8n3prv6tez",
"direction": "inbound",
"from": { "phone_number": "+16505551234" },
"to": { "phone_number": "+13124495648" },
"status": "received",
"in_reply_to_message_id": "wam_01kya19eknftrs2s6p82asmvnh",
"interactive_reply": {
"type": "button",
"button": {
"slug": "cancel-booking",
"text": "Cancel"
}
},
"created_at": "2026-08-25T09:04:11Z"
}भेजते समय आपने जो slug सेट किया था वह हूबहू वापस आता है, इसलिए आप बिना किसी lookup table के सीधे उस पर branch कर सकते हैं। यह रिप्लाई आपको message list या GET /v1/whatsapp/messages/{id} के ज़रिए दिखता है; पूरे पथ के लिए hub का रिप्लाई पढ़ना देखें।
सीमाएँ और विशेष स्थितियाँ
- Customer service window खुला होना चाहिए। Reply buttons एक service मैसेज हैं, केवल खुले window के अंदर ही डिलीवर होते हैं; hub का customer service window देखें। Window की जाँच fails open है, इसलिए
202इस बात का प्रमाण नहीं है कि भेजते समय window वास्तव में खुला था। fromआपके वर्कस्पेस के स्वामित्व वाला नंबर होना चाहिए। इसे छोड़ना, या ऐसा नंबर देना जो कनेक्टेड sender नहीं है, send बनने से पहले ही reject कर दिया जाता है।- Labels अद्वितीय होने चाहिए, वरना send अस्वीकार हो जाता है। एक ही
quick_reply.textवाले दो बटन422E15056WhatsAppInteractiveDuplicateLabelके साथ विफल होते हैं, क्योंकि Meta अन्यथा send स्वीकार और चार्ज होने के बाद duplicate को reject कर देता। - Label वह है जो प्राप्तकर्ता देखता है; slug कभी नहीं दिखता।
slugमें user-facing कॉपी डालना एक साइलेंट no-op है, क्योंकि चैट में केवलtextरेंडर होता है। - एक मीडिया हेडर URL जिसे WhatsApp fetch नहीं कर पाता, send स्वीकार होने के बाद विफल होता है। Bird हेडर
urlको उस तरह validate नहीं करता जैसे वह मीडिया मैसेज के URL को करता है, इसलिए एकhttp://URL या error लौटाने वाला URL request पास कर जाता है और फिर asynchronously विफल होता है, मैसेज केlast_errorपरmedia_rejectedके साथ। - Meta के अपने field names भेजने पर request विफल हो जाता है। यह type अज्ञात properties को सीधे reject करता है, इसलिए Meta के Cloud API reference से कॉपी किए गए JSON, जैसे कोई
bodyobject याaction.buttonswrapper, को पहले Bird के flat fields में बदलना होगा।
एक कोट जो resolve नहीं होता, कुछ भी बनने या चार्ज होने से पहले request को विफल कर देता है: 404 E15071 जब id ऐसे मैसेज को इंगित करता है जो इस वर्कस्पेस में नहीं है, 422 E15072 जब वह ऐसे मैसेज को इंगित करता है जिसे कोट नहीं किया जा सकता। किसी भी WhatsApp send में आने वाली त्रुटियों के लिए, जैसे बंद window, अनुपलब्ध या अमान्य sender, या अमान्य प्राप्तकर्ता, hub के errors और WhatsApp मैसेज भेजना देखें।
अगले कदम
- WhatsApp interactive messages: सभी छह interactive types में क्या समान है
- लिस्ट मेन्यू: तीन से ज़्यादा विकल्पों के लिए
- WhatsApp मैसेज भेजना: request envelope,
202मॉडल, और सुरक्षित फिर से प्रयास
संबंधित संसाधन
इस विषय के लिए दस्तावेज़, गाइड और उदाहरणों के साथ आगे बढ़ें।