Two-way

टेक्स्ट वापस आते हैं। तो उन्हें संभालें।

इसमें सेट अप करें:
Cursor

आपके provisioned नंबर पर कोई भी जो मैसेज भेजता है, वह एक HMAC-signed webhook के रूप में आता है। text पढ़ें, उसी नंबर से जवाब दें, और STOP और HELP को Bird पर छोड़ दें। जिस API से आप पहले से भेजते हैं, उसी पर conversational flows और auto-replies बनाएं।

send-notification.ts
202 · 0.4s
import { BirdClient } from "@messagebird/sdk";

const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });

const { data, error } = await bird.sms.send({
  from:     "Bird",
  to:       "+31612345678",
  text:     "Your order #4821 has shipped. Track it: bird.ly/t/4821x",
  category: "transactional",
}).safe();

if (error) throw error;
console.log(data.id);
// → "sms_01m11jw130e7svjzv70kgqr38w"
Hi Ada, reminder of your appointment tomorrow at 14:30 with Dr. Kowalski.
Your order #4821 has shipped. Track it: bird.ly/t/4821x
Your subscription renews on 3 Sep for €12/mo. Manage it here: bird.ly/account

Inbound बस एक और webhook है।

Two-way is part of the Bird SMS API. When someone texts your number, you get an sms.received event on the same signed, replay-protected endpoint that already carries your delivery receipts. There's no second integration and no polling: verify the signature once and switch on the type.

जो वापस आता है, उसे सुनें।

एक inbound मैसेज और एक opt-out events हैं, ठीक delivery receipt की तरह। एक signature verify करें, type पर switch करें, और हर एक को उसी handler में संभालें जो आपने पहले ही लिख लिया है।

app/api/webhooks/bird/route.ts
signed
import { bird } from "@/lib/bird";

export async function POST(req: Request) {
  const event = bird.webhooks.unwrap(
    await req.text(),
    Object.fromEntries(req.headers),
  );

  switch (event.type) {
    case "sms.received":
      await handleInbound(event.data.from, event.data.text);
      break;
    case "sms_suppression.created":
      await removeFromCampaigns(event.data.destination);
      break;
  }

  return new Response(null, { status: 204 });
}

payload हर Bird channel पर वही envelope है: एक evt_ id, एक HMAC signature, और एक replay-protected timestamp।

  • sms.receivedAn inbound message landed on your number: carries the sender, your number, and the text.
  • sms.deliveredआपके द्वारा भेजा गया एक जवाब handset तक पहुँचा (carrier DLR)।
  • sms_suppression.createdThe sender texted STOP: Bird suppressed that sender-and-recipient pair and blocks future sends from it.

एक signed inbound मैसेज, पूरे विस्तार में।

यहाँ देखें कि एक sms.received event wire पर कैसा दिखता है। from वह है जिसने आपको टेक्स्ट किया, to आपका provisioned नंबर है, और segments तथा encoding उसी तरह रिपोर्ट किए जाते हैं जैसे किसी send पर, इसलिए एक लंबा inbound जवाब कभी surprise नहीं होता।

sms.received
evt_
{
  "id": "evt_7nQ9xLp2aR...",
  "type": "sms.received",
  "created_at": "2026-06-26T14:03:11Z",
  "data": {
    "id": "sms_5hV02Mr3n...",
    "from": "+15005550006",
    "to": "+14155550172",
    "text": "YES book me in for Thursday",
    "encoding": "GSM-7",
    "segments": 1
  }
}

उसी नंबर से जवाब दें।

एक जवाब वही send है जिसमें from और to आपस में बदल दिए गए हों। from को अपने नंबर पर और to को मूल भेजने वाले पर सेट करें, और बातचीत एक ही नंबर पर बनी रहती है, ताकि प्राप्तकर्ता को हर बार नए sender के बजाय एक thread दिखे। इसके ऊपर auto-replies, confirmations, या पूरा conversational flow बनाएं।

reply.ts
200 · reply
async function handleInbound(from: string, text: string) {
  if (/^yes\b/i.test(text)) {
    const { error } = await bird.sms.send({
      from:     "+14155550172", // your two-way number
      to:       from,           // reply to the sender
      text:     "Booked. See you Thursday at 10am.",
      category: "transactional",
    }).safe();

    if (error) throw error;
  }
}

STOP, HELP, और START आपके लिए संभाले जाते हैं।

Bird recognizes the reserved keywords before they reach your handler: STOP adds the sender to your suppression list and fires sms_suppression.created, HELP returns an automatic help reply, and START opts them back in. Later sends from that sender to a suppressed number are blocked automatically. You can still keep your own keywords for YES, BOOK, or anything your flow needs. The full keyword and opt-out rules live in opt-out handling.

दो चीज़ें जो आप आगे चाहेंगे।

Inbound needs a two-way-capable number: long codes, short codes, and toll-free can receive, alphanumeric sender IDs can't. For richer back-and-forth on the same handset (typing indicators, read receipts, carousels), RCS upgrades the conversation where the device supports it.

docs में और गहराई से जाएं।

inbound events के लिए webhooks wire करें, जिन failures को आप संभालेंगे उनके लिए error reference पढ़ें, और keyword तथा consent नियमों के लिए abuse and compliance देखें।

एक नंबर, एक API पर भेजें और पाएं।

Two-way inbound, Bird SMS API की एक क्षमता है: sending, numbers, compliance, routing, और analytics इसके साथ आते हैं, उस infrastructure पर जिसे हम एक दशक से चला रहे हैं।

एक चैनल से शुरुआत करें।
तैयार होने पर बाकी जोड़ें।

एक test API key तुरंत आपकी है। जब आप payment method जोड़ते हैं और sender verify करते हैं, तब production अनलॉक हो जाता है।

Claude Code, Cursor या Codex इस्तेमाल कर रहे हैं? एक setup prompt कॉपी करें और आपका agent आपके लिए Bird CLI और skills इंस्टॉल कर देगा। अपना चुनें:

Cursor