Email भेजें

आपके हर email के लिए एक API।

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

Transactional हो या marketing, एक message हो या सौ, सब एक ही Email API से भेजे जाते हैं, जिसमें idempotency, suppression और webhooks पहले से मौजूद हैं। raw HTML pass करें या अपने React Email templates को render करें।

welcome.tsx
200 · 1.2s
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..."

अपना पहला email पाँच मिनट में भेजें।

उसी language से जो आप पहले से इस्तेमाल करते हैं।

Sending is the core of the Bird Email API. Your first send can go to a sandbox address (delivered@messagebird.dev), so you can exercise the whole platform (sends, webhooks, suppression) before you verify a domain.

1
2
3
4
5
6
7
const msg = await bird.email.send({
  from: { email: "onboarding@messagebird.dev", name: "Bird" },
  to: ["delivered@messagebird.dev"],
  subject: "Hello from Bird",
  html: "<p>My first Bird email.</p>",
});
console.log(msg.id, msg.status); // "em_…", "accepted"

पाँच चीज़ें जो आप खुद नहीं बनाते।

हर Bird channel पर वही contract।

  1. 01

    Transactional + marketing.

    वही endpoint एक password reset भेजता है या एक campaign। एक category फील्ड तय करता है कि suppression और unsubscribes कैसे लागू होंगे।

  2. 02

    Templates आपके तरीके से।

    Pass raw HTML, render React Email templates to HTML in your app and send the result, or name a stored template and have it rendered for you. Your toolchain, unchanged.

  3. 03

    100 तक batch करें।

    प्रति call अधिकतम 100 स्वतंत्र messages, हर एक का अपना recipient और variables, एक इकाई के रूप में validate किए जाते हैं ताकि आप कभी आधा-अधूरा न भेजें।

  4. 04

    contract से ही idempotent।

    हर send एक idempotency key स्वीकार करता है, इसलिए timeout के बाद retry की गई request दोबारा भेजने के बजाय मूल नतीजा ही लौटाती है।

  5. 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 शामिल हैं।

sendgrid.ts
SendGrid
import sgMail from "@sendgrid/mail";

sgMail.setApiKey(process.env.SENDGRID_API_KEY!);

await sgMail.send({
  from:    "hello@yourdomain.com",
  to:      "delivered@messagebird.dev",
  subject: "Your invite is ready",
  html:    "<p>Welcome aboard, Ada.</p>",
});
bird.ts
Bird
import { BirdClient } from "@messagebird/sdk";

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

await bird.email.send({
  from:    "hello@yourdomain.com",
  to:      ["delivered@messagebird.dev"],
  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 करने के लिए सुरक्षित बना देती है।

digest.ts
202 · batch
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:    "Acme <hello@yourdomain.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 के साथ चलते रहें।

tagged.ts
await bird.email.send({
  from:     "Acme <hello@yourdomain.com>",
  to:       ["delivered@messagebird.dev"],
  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 करते हैं।

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 "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.acceptedThe send was accepted and is being prepared for delivery.
  • email.processedQueued for the recipient's mail server.
  • email.deliveredThe recipient's mail server accepted the message.
  • email.deferredTemporarily refused, and we will retry.
  • email.bouncedPermanently failed: bounce type and SMTP code in the payload.
  • email.openedThe recipient opened the message. Can fire more than once.
  • email.clickedThe recipient clicked a tracked link.
  • email.complainedrecipient ने message को spam के रूप में रिपोर्ट किया।
  • email.unsubscribedThe recipient opted out through a tracked unsubscribe link.

live होने से पहले हर नतीजा test करें।

In the sandbox the recipient address decides the result, so your account state doesn't have to. Send to delivered@messagebird.dev for a clean delivery, or to bounce@, softbounce@, deferred@, complaint@, and suppressed@ to drive each failure path through the real pipeline and the real webhooks. No domain to verify, no risk to your reputation. Production is deliberately gated: you verify a domain first, and a new domain or dedicated IP ramps through warmup before it carries full volume.

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

sending guide पढ़ें, email events और webhooks wire up करें, या अगर आप किसी दूसरे provider से आ रहे हैं, तो SendGrid, SES, Mailgun या Resend से एक migration guide follow करें।

दुनिया का करीब 40% commercial email पहले से ही Bird पर चलता है।

एक दशक से हमारे चलाए infrastructure पर transactional और marketing email। Sending, Bird Email API की एक क्षमता है: deliverability, dedicated IPs, suppression और analytics इसके साथ आते हैं।

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

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

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

Cursor