Search for Secondary Email

wodka
Member

Currently we search for Primary and Secondary emails similar to the solution in https://community.hubspot.com/t5/APIs-Integrations/Search-Contacts-for-Secondary-Mail/m-p/358756/hig...

 

Problem we are having there is that we manually must filter the results IF the email was actually found. (as it will return entries that have only a partial match)


Example:

We have 2 contacts:
A: michael@example.com, mcl@something.else
B: michael.schramm@example.com, michael.schramm2@example.com


We now want to find michael@example.com and therefor execute the search request:

{
  "filterGroups": [
    {
      "filters": [
        {
          "value": "michael@example.com",
          "propertyName": "hs_additional_emails",
          "operator": "CONTAINS_TOKEN"
        }
      ]
    },
    {
      "filters": [
        {
          "value": "michael@example.com",
          "propertyName": "email",
          "operator": "EQ"
        }
      ]
    }
  ]
}


Will now return both entries...

is there a way to only return exact email matches?

0 Upvotes
1 Reply 1
dennisedson
Community Manager

@wodka 

What happens if you replace the CONTAINS_TOKEN operator with EQ?

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes