Segment

Use EmailSendX as a Segment destination to automatically sync contacts and trigger automation workflows from your Segment event stream — no additional backend code required.

Overview

Segment acts as a central data pipeline. When you instrument your app with Segment and add EmailSendX as a destination, Segment automatically forwards your identify() and track() calls to EmailSendX without any additional work on your end.

identify()

Creates or updates an EmailSendX contact. The userId or email trait is used as the contact email. All traits are stored as contact metadata.

track()

Fires a custom event on the associated contact. The Segment event name maps directly to the EmailSendX custom event name, triggering matching automations.

Setup

Option A: Official EmailSendX destination in Segment Catalog

  1. In Segment, go to Connections → Catalog → Destinations.
  2. Search for EmailSendX and click Add Destination.
  3. Select the source you want to connect (e.g., your web app or mobile app source).
  4. In the destination settings, paste your EmailSendX API Key from Settings → API.
  5. Optionally configure a default list ID to assign identified contacts to a list.
  6. Enable the destination and click Save.

Option B: Webhook destination (alternative)

If you prefer to use Segment's generic webhook destination, point it at EmailSendX's Segment endpoint:

bash
POST https://emailsendx.com/api/segment/track
Headers:
  Authorization: Bearer esx_live_your_key_here
  Content-Type: application/json

This endpoint accepts Segment's standard webhook payload format and processes identify and track calls.

Supported Tracking Calls

EmailSendX processes two types of Segment calls:

identify()

An identify() call creates or updates an EmailSendX contact. The contact is looked up by email address (either from userId if it's an email, or from traits.email).

Field mapping:

Segment FieldEmailSendX Field
traits.email or userId (if email)contact.email
traits.firstName or traits.first_namecontact.firstName
traits.lastName or traits.last_namecontact.lastName
All other traitscontact.metadata (key-value pairs)
js
// Segment identify() call — EmailSendX creates/updates the contact
analytics.identify('user_12345', {
  email: 'morgan@acme.com',
  firstName: 'Morgan',
  lastName: 'Lee',
  plan: 'pro',               // → metadata.plan
  company: 'Acme Corp',     // → metadata.company
  signupSource: 'landing',  // → metadata.signupSource
});

track()

A track() call fires a custom event on the associated contact in EmailSendX. The Segment event name maps directly to the EmailSendX custom event name. This triggers any active automations with a matching CUSTOM_EVENT trigger.

The call requires a prior identify() (or the userId must resolve to an existing contact). Segment's event.properties are passed as the EmailSendX event data payload.

js
// Segment track() call — fires 'purchase_completed' event in EmailSendX
analytics.track('purchase_completed', {
  orderId: 'ord_xyz123',
  amount: 99.00,
  currency: 'USD',
  items: ['Pro Plan - Annual'],
});

// In EmailSendX, any automation with trigger:
// CUSTOM_EVENT = "purchase_completed"
// ...will fire for this user.

Event name normalization

Segment event names are passed as-is to EmailSendX. The matching in EmailSendX automations is case-insensitive, so Purchase Completed, purchase_completed, and PURCHASE_COMPLETED all match the same automation trigger.

Using RudderStack instead of Segment?

EmailSendX supports RudderStack with the same identify/track model.