Skip to main content
Mailgun → SnowflakeIntegration guide

Connecting Mailgun to Snowflake

Mailgun is developer-facing email infrastructure, which means the sending logic lives in your application and the marketing team frequently does not know what is being sent or when. Snowflake's distinguishing feature is that two organisations can join data without either copying it to the other, which turns measurement between partners from a legal negotiation into a query. The join between them succeeds or fails on one thing: whether whatever join key both parties agree on, usually a hashed identifier reaches the Mailgun message before the conversion happens, because Snowflake can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Mailgun event logs in Snowflake, joined to orders by user

Stream Mailgun webhook events or poll the Events API into Snowflake with raw payloads, since Mailgun retention is plan-limited. Put user ID, order ID and a trigger name in custom variables at send time and keep the message ID to group events. Deduplicate on event ID, treat opens as noisy, and attribute revenue at the order with a written rule.

Snowflake is where Mailgun's data is most useful, because it can sit next to orders and answer what nobody can answer inside Mailgun: which code path sent this, and did anyone buy afterwards. Mailgun's own log retention is limited by plan, so if you want history, stream webhook events or poll the Events API into Snowflake and keep the raw payload alongside any columns you derive.

The join comes from what you attach at send time. Put your user ID, order ID where there is one, and a trigger name into each message's custom variables; Mailgun returns them on every event for that message. Without them you are left joining on email address and timestamp, which breaks on shared inboxes and address changes. Keep Mailgun's message ID too, so delivered, opened and clicked rows group into one send.

Mailgun retries webhooks when your endpoint does not acknowledge in time, so the same event can arrive twice. Deduplicate on Mailgun's event ID in a scheduled step before any model reads the table. Treat opens as noisy, because Apple Mail prefetches images, and attribute revenue at the order with an explicit rule, such as an email click within a set number of days, written down in the model rather than implied.

Mailgun → Snowflake · what breaks

Why this join usually fails — Mailgun → Snowflake

  1. 01

    Whatever join key both parties agree on, usually a hashed identifier never reaches Mailgun

    No session, no click, and the trigger conditions are buried in application code rather than in a campaign tool.

  2. 02

    Nobody able to say why a message was sent

    When send logic lives in application code, the marketing team cannot audit it and the engineering team is not thinking about attribution. Messages accumulate, nobody owns the list, and any analysis of email's contribution is unreliable.

  3. 03

    A clean room that answers a question nobody agreed on

    The technology makes the join possible; it does not make the definitions match. Two organisations measuring the same campaign will disagree about what a conversion is, which window applies and whose attribution model governs — and the query will return a confident number for whichever set of assumptions got written into the SQL.

  4. 04

    Nothing reconciles afterwards

    Snowflake will not tell you anything is wrong. Verify by querying against each party's own totals and checking for duplicate rows on the join key before trusting any aggregate.

Mailgun → Snowflake · the fix

What working looks like — Mailgun → Snowflake

  • Whatever join key both parties agree on, usually a hashed identifier on every message

  • Conversions arriving in Snowflake

    The row lands in a table you own, joinable to your own data and — through a share or clean room — to a partner's, without either party moving raw records.

  • Reconciled against the source

Mailgun → Snowflake · architecture

How Mailgun and Snowflake actually connect

  1. 1

    Mailgun holds the truth

    Because sends are triggered in code, the only reliable description of why a message went out lives in your application, not in Mailgun's logs.

  2. 2

    Snowflake needs a click to match

    A schema both sides agree on, consistent types, and identifiers normalised identically before hashing. The failure mode is not rejection but silent divergence — a timestamp in the wrong zone or a trimmed-versus-untrimmed email produces answers that look plausible.

  3. 3

    The identifier is the bridge

    Whatever join key both parties agree on, usually a hashed identifier, captured at the visit and carried into the Mailgun message.

  4. 4

    The event source decides reliability

    Send orders. Use Mailgun events for deliverability monitoring only.

  5. 5

    Deduplication at the destination

    Nothing deduplicates for you. Loads are at-least-once, so a retried pipeline creates duplicate rows and the only protection is a deduplication step you write and actually schedule.

Mailgun → Snowflake · normal or broken

Working vs. broken, side by side — Mailgun → Snowflake

Normal, not a fault

  • Whatever join key both parties agree on, usually a hashed identifier present on the message

  • Sent from your order system

  • Deduplicated correctly

    Nothing deduplicates for you. Loads are at-least-once, so a retried pipeline creates duplicate rows and the only protection is a deduplication step you write and actually schedule.

  • Reconciles with the source

Actually broken

  • Whatever join key both parties agree on, usually a hashed identifier missing on most records

    No session, no click, and the trigger conditions are buried in application code rather than in a campaign tool.

  • Sent from the browser

    When send logic lives in application code, the marketing team cannot audit it and the engineering team is not thinking about attribution. Messages accumulate, nobody owns the list, and any analysis of email's contribution is unreliable.

  • Counted twice, or not at all

    The technology makes the join possible; it does not make the definitions match. Two organisations measuring the same campaign will disagree about what a conversion is, which window applies and whose attribution model governs — and the query will return a confident number for whichever set of assumptions got written into the SQL.

  • Nobody has reconciled it

Mailgun → Snowflake · diagnose

Diagnostic order — Mailgun → Snowflake

  1. 01

    Count messages carrying whatever join key both parties agree on, usually a hashed identifier

  2. 02

    Follow one real conversion end to end

  3. 03

    Inventory every code path that triggers a send

    Usually the first time anyone has, and it frequently finds sends nobody remembers building.

  4. 04

    Write down both parties' conversion definitions before writing any query

    Definition mismatch, not technology, is what makes most partner measurement projects produce numbers neither side trusts.

  5. 05

    Read the match rate, not the success message

    Snowflake will not tell you anything is wrong. Verify by querying against each party's own totals and checking for duplicate rows on the join key before trusting any aggregate.

Mailgun → Snowflake · prove

How it gets proven — Mailgun → Snowflake

Source of truth

Your application's own record of what triggered the send, joined to the order.

  • Whatever join key both parties agree on, usually a hashed identifier confirmed present on a live message.
  • Row counts and revenue reconciled against each source system for a closed window, with duplicates checked on the join key and both definitions documented.
  • Orders reconciled against imported conversions, with the send inventory documented.

Mailgun → Snowflake · free audit

What we check in the free audit

  • Count messages carrying whatever join key both parties agree on, usually a hashed identifier
  • Follow one real conversion end to end
  • Inventory every code path that triggers a send
  • Write down both parties' conversion definitions before writing any query
  • Read the match rate, not the success message

Checked against

Your application's own record of what triggered the send, joined to the order.

Get my free conversion tracking audit

Free30 minutesNo obligation

Mailgun → Snowflake · when not to buy

When you don't need this — Mailgun → Snowflake

  • Measure identifier coverage yourself first — pull your last hundred messages and count how many carry whatever join key both parties agree on, usually a hashed identifier.
  • Deliverability monitoring is the right use of Mailgun's data. Attribution belongs at the order.
  • If you have no partner to share data with and one cloud, a warehouse you already run does the same job. The sharing capability is what justifies this one.

Mailgun → Snowflake · what we deliver

What gets built — Mailgun → Snowflake

  • Identifier capture into Mailgun

    Record the trigger reason on the message in your own system and attribute at the order.

  • Event source: your order system

    Send orders. Use Mailgun events for deliverability monitoring only.

  • Dispatch to Snowflake

    Batch or streaming loads from your order system, with the raw event retained alongside anything you derive from it.

  • Reversals where they exist

    Refunds reverse at the order.

Written guarantee

95%+ tracking accuracy

Measured against Your application's own record of what triggered the send, joined to the order.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Mailgun → Snowflake questions, answered

Send Mailgun webhooks to an endpoint that writes to Snowflake, or poll the Events API on a schedule. Keep the raw payload so you can rebuild derived tables later.

Free · 30 min

Get Mailgun and Snowflake joined properly

Free30 minutesNo obligation