Salesforce Integration • Apex + REST API

Enrich every Salesforce Lead and Contact with email risk data automatically

An Apex trigger calls Emailyze before insert and writes risk score, disposable flag, and provider type directly to custom fields — no ETL, no middleware, no manual exports.

Before-insert trigger • Fail-open on API errors
Salesforce › Leads › [email protected]

Emailyze Custom Fields

Emailyze_Risk_Score__c

87

Emailyze_Is_Disposable__c

true

Emailyze_Provider_Type__c

disposable
Enriched by Emailyze — before insert

How it works

From package install to enriched Lead in four steps.

1

Install the package

Add the Emailyze unlocked package to your Salesforce org. Custom fields are created automatically on Lead and Contact objects.

2

Fields created automatically

Three custom fields appear: Emailyze_Risk_Score__c, Emailyze_Is_Disposable__c, and Emailyze_Provider_Type__c.

3

Apex trigger fires on Lead insert

The bundled Apex trigger fires before insert, calls the Emailyze REST API via a named credential, and captures the response.

4

Properties written back

Risk score, disposable flag, and provider type are written to the three custom fields before the record is committed to the database.

Apex Trigger

Drop this into your Salesforce org. Uses a Named Credential for the API key — no hardcoded secrets.

EmailyzeLeadCheck.trigger
trigger EmailyzeLeadCheck on Lead (before insert) {
    Http http = new Http();
    for (Lead lead : Trigger.new) {
        if (lead.Email == null) continue;

        HttpRequest req = new HttpRequest();
        req.setEndpoint(
            'https://api.emailyze.xyz/v1/check/?email='
            + EncodingUtil.urlEncode(lead.Email, 'UTF-8')
        );
        req.setMethod('GET');
        req.setHeader('X-API-Key', '{!$Credential.Emailyze.APIKey}');
        req.setTimeout(5000);

        try {
            HttpResponse res = http.send(req);
            if (res.getStatusCode() == 200) {
                Map<String, Object> body = (Map<String, Object>)
                    JSON.deserializeUntyped(res.getBody());

                lead.Emailyze_Risk_Score__c =
                    (Decimal) body.get('risk_score');
                lead.Emailyze_Is_Disposable__c =
                    (Boolean) body.get('is_disposable');
                lead.Emailyze_Provider_Type__c =
                    (String)  body.get('provider_type');
            }
        } catch (Exception e) {
            // Fail open — don't block lead creation on API errors
            System.debug('Emailyze callout failed: ' + e.getMessage());
        }
    }
}

Replace {!$Credential.Emailyze.APIKey} with your Emailyze API key or a Named Credential reference.

Use cases

Turn enrichment data into action across your Salesforce org.

Lead scoring

Automatically subtract points from leads with disposable emails. Feed Emailyze_Risk_Score__c into your Einstein or custom scoring model to surface only high-intent prospects.

Assignment rules

Route leads with Emailyze_Is_Disposable__c = true to a junk queue instead of your sales team. Stop wasting rep time on throw-away sign-ups.

Campaign exclusion

Use a Campaign Member filter on Emailyze_Is_Disposable__c to exclude disposable addresses before sending. Protect your deliverability and marketing Salesforce credits.

Sales alerts

Create a Process Builder or Flow that opens a Task for the account owner when a high-risk lead (score ≥ 80) is created. Flag suspicious activity before it becomes fraud.

Start enriching Salesforce leads today

Get your API key, paste the Apex trigger, and every new Lead will have disposable email data before it hits the database.

Free plan included • No credit card required • Cancel anytime