iOS, Android, और web के लिए push notifications।
Token-management abstraction, per-device opt-in, native rich payloads, segment targeting। हर दूसरे Bird channel जैसा ही auth, वही idempotency, वही webhooks — क्योंकि इन सबको एक ही engineering team ने बनाया है।
import { BirdClient } from "@messagebird/sdk";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
// Send by device token...
const { data, error } = await bird.push.send({
to: "token_aPa91Hb...XzQ",
title: "Your driver is two minutes away",
body: "Tap to see the live map.",
data: { ride_id: "ride_2891" },
}).safe();
// ...or by user_id — we fan out to every opted-in device.
await bird.push.send({
to: { user_id: "usr_4hQ2m" },
title: "Your code is 482917",
body: "Enter it on the login screen.",
data: { kind: "otp" },
});
if (error) throw error;
console.log(data.id);
// → "push_2nQ81oP3..."
npm install से पहली send तक 5 मिनट
जिस भाषा का आप पहले से इस्तेमाल करते हैं, उसी से notification भेजें।
हर प्रमुख runtime में SDKs। अपने mobile या web client से एक token register करें; अपने backend से token या user_id के जरिए भेजें।
import { BirdClient } from "@messagebird/sdk";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
const { data, error } = await bird.push.send({
to: "token_aPa91Hb",
title: "Hello",
body: "From Bird Push",
data: { kind: "demo" },
}).safe();दस primitives जो APNs और FCM को एक endpoint में बदल देते हैं।
अंदर असली APNs और FCM — बीच में कोई third-party push aggregator नहीं। हम बस platform की खासियतों को एक ही shape के पीछे छिपा देते हैं।
- 01
एक call से iOS, Android, और web
एक bird.push.send। हम हर registered device के लिए APNs, FCM, और W3C Push Protocol पर fan out करते हैं।
- 02
Token-management abstraction
bird.push.tokens.register से एक token register करें। हम platform, locale, और last-seen को track करते हैं ताकि आपको न करना पड़े।
- 03
token या user_id के जरिए भेजें
किसी एक device को address करें, या
{ user_id }पास करें और हम उनके हर opted-in device पर fan out कर देते हैं। - 04
Per-device opt-in state
हर registered token अपना खुद का opt-in state रखता है। एक को revoke करें बिना दूसरों पर असर डाले।
- 05
Native rich payloads
Title, body, image, action buttons, deep-link URL, custom data — APNs alert और FCM notification में सही ढंग से mapped।
- 06
Silent / background notifications
content_available: true पास करें और हम हर platform के हिसाब से APNs background और FCM data-only के जरिए सही routing करते हैं।
- 07
Segment targeting
registration के समय users को tag करें; bird.push.send से tag के जरिए address करें। किसी third-party CDP integration की जरूरत नहीं।
- 08
Delivery और open receipts
push.delivered, push.opened, push.dismissed के लिए events। हर दूसरे channel जैसा ही HMAC envelope।
- 09
Token lifecycle संभाला गया
जब APNs / FCM कोई unregistered token लौटाता है, हम उसे dead mark कर देते हैं और भेजना रोक देते हैं। कोई manual cleanup नहीं।
- 10
वही auth, वही error envelope
Push, SMS, Email, WhatsApp, Voice के लिए एक API key। इन सबके लिए एक error type registry।
हम Push क्यों बनाते हैं
क्योंकि push को आपके SMS, आपके email, और आपके verifications से अलग vendor में नहीं रहना चाहिए।
हर product team आखिर में उसी stack पर पहुंचती है: iOS के लिए APNs, Android के लिए FCM, web के लिए एक service worker, और एक database table जो track करता है कि किस user के पास कौन-से tokens हैं और किस opt-in state के साथ। हमने वह table बनाया, फिर उसे दोबारा बनाया, और फिर उसे bird.push.tokens.register और bird.push.send के रूप में expose किया। Email और SMS जैसा ही auth, वही idempotency, वही error envelope — ताकि जो OTP push पर fail होता है वह उसी request में SMS पर fall back कर जाए।
import { BirdClient } from "@messagebird/sdk";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
// Send by device token...
const { data, error } = await bird.push.send({
to: "token_aPa91Hb...XzQ",
title: "Your driver is two minutes away",
body: "Tap to see the live map.",
data: { ride_id: "ride_2891" },
}).safe();
// ...or by user_id — we fan out to every opted-in device.
await bird.push.send({
to: { user_id: "usr_4hQ2m" },
title: "Your code is 482917",
body: "Enter it on the login screen.",
data: { kind: "otp" },
});
if (error) throw error;
console.log(data.id);
// → "push_2nQ81oP3..."
हर state change एक webhook है।
HMAC-signed payloads, replay-protected, idempotent। हर Bird channel पर वही envelope — एक सीखें, सब सीख गए।
{
"type": "push.delivered",
"id": "evt_9pT81y...",
"created_at": "2026-05-19T15:42:01.221Z",
"data": {
"push_id": "push_2nQ81oP3",
"user_id": "usr_4hQ2m",
"platform": "ios",
"device": "iPhone15,2",
"latency_ms": 218
}
}
Retry schedule: 5s, 30s, 5m, 30m, 2h, 6h, 12h। आखिरी attempt के बाद dead-letter; हर dead-lettered event को dashboard या API से replay किया जा सकता है।
push.queuedAPI ने accept किया और send के लिए queue कर दिया।push.sentAPNs / FCM / W3C Push server को सौंप दिया गया।push.deliveredProvider ने device तक delivery की पुष्टि की (जब उपलब्ध हो — APNs best-effort है)।push.openedUser ने notification tap किया (अगर आपका app इसे instrument करता है)।push.dismissedUser ने खोले बिना dismiss कर दिया (अगर आपका app इसे instrument करता है)।push.failedस्थायी failure (token unregistered, app हटा दिया गया)। token अपने आप disable हो जाता है।
अगर आपने SMS integrate किया है, तो आपने Push integrate कर लिया।
वही auth, वही idempotency contract, वही error envelope, वही webhook shape। फर्क सिर्फ transport का है — इसे call करने के तरीके का नहीं।
Push.
await bird.push.send({
to: { user_id: "usr_4hQ2m" },
title: "Your code",
body: `Code: ${code}`,
});
एक call। हम APNs, FCM, और web पर user के हर opted-in device पर fan out कर देते हैं।
SMS.
await bird.sms.send({
from: "Bird",
to: "+15005550006",
text: `Your code is ${code}.`,
category: "authentication",
});
वही envelope, वही idempotency contract। push fail होने पर fall back करें — या SMS को सीधे address करें।