Enrich every Segment identify() call with email risk signals
A Segment Destination Function calls Emailyze for every identify event, enriches the user traits with risk score, disposable flag, and provider type, then forwards the enriched event to all connected destinations.
{
"type": "identify",
"userId": "user_123",
"traits": {
"email": "[email protected]",
"emailyze_risk_score": 91,
"emailyze_is_disposable": true,
"emailyze_provider_type": "disposable"
}
}How it works
One Destination Function enriches every identify() call before it reaches any downstream destination.
identify() fires
Your app calls analytics.identify() with the user's email. Segment routes the event to the "Emailyze Enrichment" Destination Function.
Emailyze API called
The function calls the Emailyze REST API with the email address and receives risk_score, is_disposable, and provider_type in the response.
Traits enriched + forwarded
The three risk signals are merged into the user traits. The enriched identify() call is forwarded to every connected Segment destination automatically.
Destination Function
Create a new Destination Function in Segment, paste this code, and add your API key as the EMAILYZE_API_KEY setting.
// Segment Destination Function
// Settings: EMAILYZE_API_KEY (string, required)
async function onIdentify(event, settings) {
const email = event.traits && event.traits.email;
if (!email) return;
const response = await fetch(
`https://api.emailyze.xyz/v1/check/?email=${encodeURIComponent(email)}`,
{
headers: { "X-API-Key": settings.EMAILYZE_API_KEY },
}
);
if (!response.ok) {
// Fail open — don't block the identify call on API errors
throw new EventNotSupported(`Emailyze API error: ${response.status}`);
}
const data = await response.json();
// Enrich the traits with email risk signals
const enrichedTraits = {
...event.traits,
emailyze_risk_score: data.risk_score,
emailyze_is_disposable: data.is_disposable,
emailyze_provider_type: data.provider_type,
};
// Forward the enriched event to all connected destinations
await analytics.identify(event.userId, enrichedTraits, {
anonymousId: event.anonymousId,
});
}What you unlock
Enriching at the CDP layer means every tool in your stack gets email risk data — automatically.
Audience builder
Create a Segment Audience using emailyze_is_disposable = true to instantly surface every low-quality user in your system. Feed it directly to a suppression list.
Warehouse enrichment
Every identify() call lands in your data warehouse with email risk fields included. Query emailyze_risk_score directly in BigQuery, Snowflake, or Redshift.
Ad suppression
Sync your disposable-email Audience to Facebook, Google Ads, or LinkedIn. Exclude them from lookalike audiences and retargeting — stop wasting ad budget.
Downstream blocking
Every destination connected to Segment — email tools, CDPs, CRMs — receives the risk flag automatically. One enrichment point, everywhere.