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
- In Segment, go to Connections → Catalog → Destinations.
- Search for EmailSendX and click Add Destination.
- Select the source you want to connect (e.g., your web app or mobile app source).
- In the destination settings, paste your EmailSendX API Key from Settings → API.
- Optionally configure a default list ID to assign identified contacts to a list.
- 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:
POST https://emailsendx.com/api/segment/track
Headers:
Authorization: Bearer esx_live_your_key_here
Content-Type: application/jsonThis 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 Field | EmailSendX Field |
|---|---|
| traits.email or userId (if email) | contact.email |
| traits.firstName or traits.first_name | contact.firstName |
| traits.lastName or traits.last_name | contact.lastName |
| All other traits | contact.metadata (key-value pairs) |
// 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.
// 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
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.