Mailgun

Mailgun is an email delivery platform. Datafly Signal keeps a Mailgun mailing list in sync: newsletter subscribe and unsubscribe events create or update the list member (POST /v3/lists/{list_address}/members, upsert=true).

Why route Mailgun through Datafly Signal

  • Events come from your server, not the browser. They reach Mailgun even when a tracker blocker or a failed page unload would have dropped a client-side call.
  • Delivery is queued and retried. Signal buffers to Kafka and retries on 429 or a transient failure rather than dropping the event; a permanent rejection goes to the dead-letter queue with the vendor’s reason.
  • One consent decision governs every destination. Mailgun is gated by the same consent state as the rest of your stack, so a withdrawal applies everywhere at once.

Get your Mailgun credentials

Copy your API key

In Mailgun open Settings > API Keys and copy the private API key.

Create the mailing list

Create the list in Mailgun and note its address (for example newsletter@mg.example.com). Note whether your account is on the US or EU region.

Configuration

FieldRequiredDescription
api_keyYesYour Mailgun Private API key. Sent as the HTTP Basic password with username ‘api’. Found in Mailgun dashboard under Settings > API Keys.
base_urlYesRegional API host. Use https://api.mailgun.net for US accounts or https://api.eu.mailgun.net for EU accounts. Must match the region your API key was created in.
list_addressYesThe address of an existing Mailgun mailing list to sync contacts into (e.g. newsletter@mg.example.com). Create the list in Mailgun first; this integration only manages members.

Management UI setup

  1. Go to Integrations in the sidebar and open the Integration Library tab.
  2. Find Mailgun under Marketing Automation and click Install.
  3. Choose a preset, enter the fields above and click Install Integration.

Management API setup

curl -X POST http://localhost:8084/v1/admin/integration-catalog/mailgun/install \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Mailgun",
  "variant": "default",
  "config": {
    "api_key": "your_api_key",
    "base_url": "your_base_url",
    "list_address": "your_list_address"
  },
  "delivery_mode": "server_side"
}'

What Signal sends

An example request, rendered from the default preset for newsletter_subscribed:

POST https://api.eu.mailgun.net/v3/lists/news@mg.example.com/members
 
address=neill%40example.com&name=Neill+Mcfixture&subscribed=true&upsert=true&vars=%7B%22first_name%22%3A%22Neill%22%2C%22last_name%22%3A%22Mcfixture%22%2C%22subscription_source%22%3A%22footer%22%2C%22user_id%22%3A%22crm-user-7%22%7D
FieldSource
addressThe member email from identify() traits, trimmed and lower-cased. Required.
nameThe name trait.
subscribedtrue on newsletter_subscribed, false on newsletter_unsubscribed; not sent otherwise, and never set from cookie consent.
varsA JSON string of custom variables: first and last name, user ID, and per event the sign-up method, subscription source, plan or last order (id, value, currency, date).
upsertAlways true: create the member or update it in place.

The list member is the email address and Mailgun accepts no hashed identifier, so it is sent in plain text. An event without an email is not sent.

Presets

PresetSignal event → vendor event
Defaultsign_up (disabled), identify (disabled), newsletter_subscribed, newsletter_unsubscribed
Retailsign_up (disabled), identify (disabled), newsletter_subscribed, newsletter_unsubscribed, purchase (disabled)
Publishingsign_up (disabled), newsletter_subscribed, newsletter_unsubscribed, subscription_started (disabled), subscription_cancelled (disabled)

Events not listed are not sent. Each preset is a starting point: add, rename or remove mappings on the installed integration.

Notes and limits

  • Sign-up, identify, purchase and the subscription events are listed but disabled. Mailgun adds a new member as subscribed unless told otherwise, so these events would put people who never asked for email on the list. Enable them only for a list people joined knowingly.
  • Page views are not sent (they upserted the member on every page).
  • Mailgun’s reference documents a multipart body; Signal sends the same fields urlencoded, which Mailgun also accepts.

Marketing-automation integrations have no consent category by default. Assign the marketing category when you install Mailgun, so an event is delivered only when the visitor has granted it. Cookie-banner consent is not email or SMS opt-in: keep messaging opt-in in Mailgun.

Verify it’s working

  1. Open the integration in the Signal Management UI and watch Live Events while you trigger a mapped event.
  2. Confirm a 2xx response from Mailgun.
  3. Find the contact in Mailgun and check the event or record arrived.

Troubleshooting

SymptomResolution
401The API key is wrong, or it belongs to the other region.
404The list address does not exist, or the base URL is the wrong region.