Transactional हो या marketing, एक message हो या सौ, सब एक ही Email API से भेजे जाते हैं, जिसमें idempotency, suppression और webhooks पहले से मौजूद हैं। raw HTML pass करें या अपने React Email templates को render करें।
import { BirdClient } from "@messagebird/sdk";
import { render } from "@react-email/render";
import { WelcomeEmail } from "./emails/welcome";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
const { data, error } = await bird.email.send({
from: "Bird <hello@bird.com>",
to: ["ada@example.com"],
subject: "Your invite is ready",
html: await render(<WelcomeEmail name="Ada" />),
}).safe();
if (error) throw error;
console.log(data.id);
// → "em_2bX91Yk8h..."
You can sign in any time at bird.com/login.
Your test API key is on your dashboard, ready to send.
अपना पहला email पाँच मिनट में भेजें।
उसी language से जो आप पहले से इस्तेमाल करते हैं।
Sending Bird Email API का मूल है। पहला send किसी अधिकृत test address (delivered@messagebird.dev) पर जा सकता है, ताकि domain verify करने से पहले ही आप पूरे platform (sends, webhooks, suppression) को आज़मा सकें।
import { BirdClient } from "@messagebird/sdk";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
const { data, error } = await bird.email.send({
from: "you@yourdomain.com",
to: ["delivered@bird.dev"],
subject: "Hello from Node",
html: "<p>It works.</p>",
}).safe();पाँच चीज़ें जो आप खुद नहीं बनाते।
हर Bird channel पर वही contract।
- 01
Transactional + marketing.
वही endpoint एक password reset भेजता है या एक campaign। एक category फील्ड तय करता है कि suppression और unsubscribes कैसे लागू होंगे।
- 02
Templates आपके तरीके से।
raw HTML pass करें, या अपने app में React Email templates को HTML में render करके नतीजा भेजें। आपका toolchain, बिना बदलाव के।
- 03
100 तक batch करें।
प्रति call अधिकतम 100 स्वतंत्र messages, हर एक का अपना recipient और variables, एक इकाई के रूप में validate किए जाते हैं ताकि आप कभी आधा-अधूरा न भेजें।
- 04
contract से ही idempotent।
हर send एक idempotency key स्वीकार करता है, इसलिए timeout के बाद retry की गई request दोबारा भेजने के बजाय मूल नतीजा ही लौटाती है।
- 05
हर state change पर एक webhook।
Accepted, delivered, opened, clicked, bounced, complained। हर एक HMAC-signed, replay-protected, idempotent, हर channel पर वही envelope।
पहले से कहीं और भेज रहे हैं? एक दोपहर में switch करें।
जो call आप पहले से करते हैं उसमें मुश्किल से कुछ बदलता है: client बदलें, अपने templates रखें, अपने webhooks को एक endpoint पर point करें। Migration guides में SendGrid, Amazon SES, Mailgun और Resend शामिल हैं।
import sgMail from "@sendgrid/mail";
sgMail.setApiKey(process.env.SENDGRID_API_KEY!);
await sgMail.send({
from: "hello@bird.com",
to: "ada@example.com",
subject: "Your invite is ready",
html: "<p>Welcome aboard, Ada.</p>",
});
import { BirdClient } from "@messagebird/sdk";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
await bird.email.send({
from: "hello@bird.com",
to: ["ada@example.com"],
subject: "Your invite is ready",
html: "<p>Welcome aboard, Ada.</p>",
});
एक message हो या सौ, एक ही call।
एक request में 100 तक स्वतंत्र messages batch करें, हर एक का अपना recipient और variables। batch एक इकाई के रूप में validate होता है: एक खराब message call को 422 के साथ reject कर देता है, इसलिए आप कभी आधा-अधूरा नहीं भेजते। एक single idempotency key पूरी request को retry करने के लिए सुरक्षित बना देती है।
import { BirdClient } from "@messagebird/sdk";
import { render } from "@react-email/render";
import { Digest } from "./emails/digest";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
const messages = await Promise.all(
users.map(async (u) => ({
from: "Bird <hello@bird.com>",
to: [u.email],
subject: "Your weekly digest",
html: await render(<Digest user={u} />),
})),
);
const { data: batch, error } = await bird.email
.sendBatch(messages, { idempotencyKey: `digest-${runId}` })
.safe();
if (error) throw error;
console.log(`queued ${batch.data.length} messages`);
हर send के साथ अपना संदर्भ जोड़ें।
Tags एक first-class, filterable dimension हैं: stats API में delivery और engagement को campaign, template या experiment के हिसाब से slice करें (प्रति message 20 तक)। Metadata मनमाना JSON है, 2 KB तक, जो हर read और webhook पर बिना छेड़छाड़ के round-trip करता है, ताकि आपके अपने IDs message के साथ चलते रहें।
await bird.email.send({
from: "Bird <hello@bird.com>",
to: ["ada@example.com"],
subject: "Your invite is ready",
html: "<p>Welcome aboard, Ada.</p>",
tags: [{ name: "campaign", value: "spring-2026" }],
metadata: { user_id: "u_2bX91", order_id: "ord_5512" },
});
हर message को उसके पूरे जीवनकाल में देखें।
एक send तुरंत 202 लौटाता है; नतीजा हर recipient के लिए एक webhook के रूप में आता है। एक signature verify करें, type पर switch करें: वही envelope जिसे आप SMS, voice और WhatsApp के लिए पहले से handle करते हैं।
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 "email.delivered":
await markDelivered(event.data.email_id);
break;
case "email.bounced":
await flag(event.data.recipient, event.data.bounce_type);
break;
}
return new Response(null, { status: 204 });
}
Hard bounces, complaints और unsubscribes आपकी suppression list को भी अपने-आप अपडेट करते हैं, ताकि एक खराब address आपकी reputation को दोबारा नुकसान न पहुँचाए।
email.acceptedAPI द्वारा स्वीकार किया गया और delivery के लिए queue किया गया।email.processedबनाया गया और sending pipeline को सौंपा गया।email.deliveredप्राप्त करने वाले mail server ने message स्वीकार कर लिया।email.deferredएक अस्थायी विफलता जिसे Bird अपने-आप retry करता है।email.bouncedस्थायी विफलता: payload में bounce type और SMTP code।email.openedTracking pixel load हुआ (बिना prefetch वाले opens गिने जाते हैं)।email.clickedएक tracked link पर click किया गया।email.complainedrecipient ने message को spam के रूप में रिपोर्ट किया।email.unsubscribedrecipient ने message body में एक tracked link के ज़रिए unsubscribe किया।
live होने से पहले हर नतीजा test करें।
sandbox में, नतीजा address तय करता है, आपके account की स्थिति नहीं। साफ delivery के लिए delivered@messagebird.dev पर भेजें, या हर failure path को असली pipeline और webhooks के ज़रिए चलाने के लिए bounce@, complaint@ और suppressed@ पर भेजें। न कोई domain verify करना, न आपकी reputation पर कोई जोखिम। Production sending उसी तरह gated है जैसे होना चाहिए: पहले आप एक domain verify करते हैं, और एक नया domain या dedicated IP पूरा volume ले जाने से पहले reputation warmup से गुज़रता है।
docs में और गहराई से जानें।
sending guide पढ़ें, email events और webhooks wire up करें, या अगर आप किसी दूसरे provider से आ रहे हैं, तो SendGrid, SES, Mailgun या Resend से एक migration guide follow करें।
Sending से जुड़े सवाल-जवाब
क्या मैं transactional और marketing दोनों तरह के Email भेज सकता हूँ?+
क्या आप React Email templates को सपोर्ट करते हैं?+
मैं एक request में कितने emails भेज सकता हूँ?+
अगर कोई request time out हो जाए और मैं उसे retry करूँ तो क्या होगा?+
rate limits क्या हैं?+
असली email भेजे बिना मैं test कैसे करूँ?+
क्या मैं MTA खुद, on-prem चला सकता हूँ?+
Email platform का बाकी हिस्सा
एक API, keys का एक सेट। बाकी क्षमताओं को explore करें।
दुनिया का करीब 40% commercial email पहले से ही Bird पर चलता है।
एक दशक से हमारे चलाए infrastructure पर transactional और marketing email। Sending, Bird Email API की एक क्षमता है: deliverability, dedicated IPs, suppression और analytics इसके साथ आते हैं।