Check if someone’s email is @ their website — i.e. is a corporate address — using FlowBoost

Outright requiring a corporate address on forms may be too frictional, or you simply may not control the lead source. But you still want to know if someone happened to provide a corporate address, right?

A quick way to do that is to compare their Website value with their Email Address. If SquashCo’s site is intavro.com and my address is sandy@intavro.com, that’s a (admittedly minor) lead quality signal.

FlowBoost has the precompiled function FBUtil.string.partsFromEmail()so you don’t have to code that yourself, and of course offers the standard URL API as FBHttp.URL.

So it’s as as simple as:

let emailAddress = {{lead.Email Address}};
let website = {{lead.Website}};

let emailParts = FBUtil.string.partsFromEmail(emailAddress);

// Website field may or may not contain the leading http://
let webURL;
if( FBHttp.URL.canParse(website) ) {
  webURL = FBHttp.URL.parse(website);
} else {
  webURL = FBHttp.URL.parse("https://" + website);
}

itMatches = emailParts.domain == webURL.hostname;

Then itMatches is a Boolean to use in a response mapping.

Notice I didn’t toLowerCase() either side. That’s because partsFromEmail().domain is already lowercased, as is new URL().hostname.[1]

Notes

[1] Specifically because the protocol is https://. You can use the URL() constructor with other protocols, too, but those don’t lowercase hostname because stuff outside of DNS may be case-sensitive. (URLs are general-purpose and hosts aren’t always DNS-based hosts!)