Two-way

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

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

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

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

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

const code = generateOtp();

const { data, error } = await bird.sms.send({
  from:     "Bird",
  to:       "+15005550006",
  text:     `Your Bird verification code is ${code}. Reply STOP to opt out.`,
  category: "authentication",
}).safe();

if (error) throw error;
console.log(data.id);
// → "sms_4kT01Lq2m..."

Today at 2:14 PM

Hey Ada, your Bird sign-in code is 482917. It'll expire in 10 minutes. Don't share it with anyone.
482917
Delivered

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.opted_out":
      await removeFromCampaigns(event.data.from);
      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.opted_outThe sender texted STOP: Bird suppressed them and blocks future sends.

एक 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 आपके handler तक पहुँचने से पहले ही reserved keywords को पहचान लेता है: STOP भेजने वाले को आपकी suppression list में जोड़ता है और sms.opted_out fire करता है, HELP एक automatic help reply लौटाता है, और START उन्हें वापस opt-in कर देता है। किसी suppressed नंबर पर आगे के sends अपने आप ब्लॉक हो जाते हैं। आप YES, BOOK, या अपने flow के लिए ज़रूरी किसी भी चीज़ के लिए अपने खुद के keywords रख सकते हैं। पूरे keyword और opt-out नियम 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 देखें।

Two-way SMS FAQ

एक inbound SMS मेरे app तक कैसे पहुँचता है?
Every message sent to your provisioned number arrives as an HMAC-signed sms.received webhook. You verify one signature, read the from, to, and text, and route it into your own logic, the same envelope you already handle for delivery receipts.
क्या मैं किसी inbound मैसेज का जवाब दे सकता हूँ?
हाँ। उसी नंबर से भेजकर जवाब दें जिस पर मैसेज आया था। from को अपने नंबर पर और to को मूल भेजने वाले पर सेट करें, और पूरा thread एक ही नंबर पर बना रहता है, शुरू से अंत तक।
जब कोई STOP टेक्स्ट करता है तो क्या होता है?
Bird adds the sender to your suppression list and fires sms.opted_out, and blocks later sends to that number automatically. HELP returns a help reply and START opts them back in, all handled before they reach your code, so you stay compliant without writing the keyword logic yourself.
क्या two-way के लिए मुझे एक विशेष नंबर चाहिए?
आपको एक two-way-capable नंबर चाहिए। Long codes, short codes, और toll-free नंबर inbound support करते हैं; alphanumeric sender ID केवल send-only होते हैं और replies नहीं पा सकते।

एक नंबर, एक 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