Migrasi dari Mailgun
Halaman ini memetakan parameter POST /v3/{domain}/messages Mailgun, daftar supresi, dan event webhook ke Bird. Ikuti panduan migrasi utama secara berurutan, dan gunakan pemetaan ini untuk langkah 1, 3, dan 4.
Serahkan ini ke agen Anda
Tempel ini ke Claude Code, Cursor, atau Codex. Agen akan mengerjakan halaman ini terhadap repositori Anda, menggunakan permukaan Bird mana pun yang sudah tersedia: server MCP jika sudah terhubung, atau CLI jika sudah terinstal dan sudah login.
Contoh kode
I am moving an email integration from Mailgun to Bird. Route through it with me.
1. Check what you already have before setting anything up. If Bird's MCP server is connected, use its tools. If the Bird CLI is installed and signed in, use that. Either one is enough, and every step below is an action you take with whichever you have. Only if neither is present, follow https://bird.com/docs/ai/set-up-your-agent.md to set one up and sign me in. Every Bird docs page serves Markdown at its own URL with `.md` appended, so fetch that rather than the HTML.
2. Read https://bird.com/docs/guides/email/migrate/mailgun.md for the parameter, suppression and event mapping, and https://bird.com/docs/guides/email/migrate.md for the order the steps go in.
3. Find and list my Mailgun usage in this repository before you change anything: the /v3/{domain}/messages call sites and any SDK wrappers around them, every o:, v: and h: prefixed parameter I pass, my webhook handler and the URL it is registered at, and every Mailgun domain I send from. Mailgun scopes almost everything per domain, so keep that list of domains: the next two steps both work through it.
4. Register each of those sending domains with Bird and give me the DNS records to publish, following https://bird.com/docs/guides/email/sending-domains.md. Leave every DNS record Mailgun uses exactly as it is: Bird's records are published alongside them and both providers authenticate side by side until I switch traffic. Publishing DNS affects mail for the whole domain, so show me the records and let me publish them.
5. Export my suppressions from Mailgun and import them into Bird before any production traffic goes through Bird, so my first sends do not reach addresses that already bounced or complained. Mailgun keeps three lists per domain, so pull GET /v3/{domain}/bounces, GET /v3/{domain}/complaints and GET /v3/{domain}/unsubscribes for every domain you found. The Bird import takes one address per request and is idempotent, so a partial re-run is safe. https://bird.com/docs/guides/email/suppressions.md has the reason taxonomy.
6. Port the send call and the webhook handler using the mapping tables on the provider page. Two things need attention rather than translation: Mailgun reports one failed event with a severity field where Bird has separate deferred and bounced events, and Bird signs deliveries per Standard Webhooks rather than Mailgun's scheme, so treat verification as a rewrite. See https://bird.com/docs/guides/webhooks.md and https://bird.com/docs/guides/email/events.md.
7. Run my whole integration against Bird's mail sandbox before any production traffic, following https://bird.com/docs/guides/email/testing-sandbox.md. Sandbox sends run the real pipeline without reaching an inbox or touching my sending reputation.
8. Stop and ask me wherever a step needs a decision. Do not point production traffic at Bird until I have seen the sandbox results and replied with the words cut over to Bird. Retiring the Mailgun path is a separate step that comes later: ask me again and wait for me to reply with the words retire the Mailgun path. A reply that agrees without naming what it is authorising is not authorisation. Finish by telling me what is left that only a person can do.Petakan panggilan pengiriman
Prefiks parameter form-encoded Mailgun (o: options, v: variables, h: headers) semuanya menjadi field JSON langsung pada POST /v1/email/messages:
| Fungsi | Mailgun | Bird |
|---|---|---|
| Pengirim | from | from |
| Penerima | to / cc / bcc | to / cc / bcc (array) |
| Subjek | subject | subject |
| Isi | html / text | html / text (minimal satu) |
| Reply-to | h:Reply-To | reply_to (array) |
| Header kustom | h:X-* | headers (objek string → string) |
| Label yang dapat difilter | o:tag | tags: pasangan {name, value} |
| Konteks bolak-balik | v:* / X-Mailgun-Variables | metadata: JSON arbitrer |
| Template tersimpan | template + t:variables | template + template.parameters |
| Penjadwalan | o:deliverytime | scheduled_at |
| Pelacakan open/click | o:tracking-opens / o:tracking-clicks | track_opens / track_clicks (default true) |
| Kategori | (tidak ada) | category: marketing (default) atau transactional |
Batas dan default field kami (jumlah penerima, batas tag dan metadata) ada di Mengirim email.
Catatan porting:
- Request menjadi JSON. Mailgun menerima multipart form data. Kami menerima body JSON dengan Content-Type: application/json. Ini biasanya perubahan mekanis terbesar dalam porting.
- v: variables dikembalikan dalam event. metadata kami bekerja dengan cara yang sama. Kami mengembalikan metadata (dan tags) Anda di setiap event webhook bersama email_id/recipient_id, sehingga handler Anda mendapatkannya kembali tanpa lookup tambahan.
- Recipient variables tidak bisa dipindahkan satu-ke-satu. recipient-variables Mailgun mempersonalisasi banyak penerima dalam satu panggilan. Di sini, tugas itu ditangani oleh batch endpoint, satu entri per penerima, masing-masing dengan kontennya sendiri atau nilai parameters-nya sendiri untuk substitusi {{ token }}.
- Template tersimpan dapat langsung dipindahkan. Parameter template Mailgun dipetakan ke field template kami dengan nilai di template.parameters. Lihat mengirim dengan template.
- Lampiran dapat langsung dipindahkan. File multipart attachment / inline Mailgun menjadi array attachments kami dengan content base64 (atur content_id untuk gambar inline). Lihat lampiran.
Ekspor supresi
Mailgun menyimpan tiga daftar per domain. Ekspor masing-masing dan jalankan melalui loop impor:
- GET /v3/{domain}/bounces
- GET /v3/{domain}/complaints
- GET /v3/{domain}/unsubscribes
Ulangi untuk setiap domain pengirim. Daftar Mailgun bersifat per domain, sedangkan supresi kami bersifat per workspace, jadi yang Anda impor adalah gabungan dari daftar semua domain Anda.
Terjemahkan event webhook
Mailgun menandakan kegagalan sementara vs permanen dengan satu event failed ditambah field severity. Kami memisahkannya:
| Hasil | Mailgun | Bird |
|---|---|---|
| Diterima/diproses | accepted | email.accepted → email.processed |
| Terkirim | delivered | email.delivered |
| Kegagalan sementara | failed (temporary) | email.deferred |
| Bounce permanen | failed (permanent) | email.bounced / email.out_of_band_bounce |
| Komplain spam | complained | email.complained |
| Diblokir/disupresi | (tidak ada) | email.rejected |
| Open | opened | email.opened |
| Click | clicked | email.clicked |
| Unsubscribe | unsubscribed | email.list_unsubscribed |
email.rejected tidak memiliki padanan di Mailgun: kami melaporkan penerima yang disupresi secara eksplisit (status rejected, rejection_reason: recipient_suppressed) alih-alih melewatkannya tanpa pemberitahuan. Tambahkan handler untuk event ini, jangan perlakukan sebagai bounce.
Verifikasi juga berubah: Mailgun menandatangani dengan HMAC atas timestamp + token di dalam objek signature payload, sedangkan kami menandatangani sesuai spesifikasi Standard Webhooks, menggunakan header, bukan field payload. Ganti kode verifikasi Anda dengan resep di Webhooks & events.
Peralihan
Ikuti domain & DNS dan sandbox smoke test di panduan utama. Keduanya tidak bergantung pada provider tertentu.
Langkah selanjutnya
- Domain pengirim: pendaftaran, siklus verifikasi, dan rekaman DNS yang Anda arahkan ulang
- Webhooks & events: pengaturan endpoint dan verifikasi Standard Webhooks
- Sandbox pengujian: uji coba integrasi baru sebelum peralihan
- Supresi: konfirmasi daftar yang diimpor dan cara kami mengelolanya selanjutnya
Sumber daya terkait
Lanjutkan dengan dokumentasi, panduan, dan contoh untuk topik ini. Sumber daya tersedia dalam bahasa Inggris.
Tonton panduannyaGetting started with emailJelajahi kemampuannyaEmailIkuti jalur pembelajaranBuild your first integrationPanduan implementasiSend your first email
Coba praktiknya dan dapatkan ringkasan implementasi