APIs & Integrations

IZolas
Participant

doSearch does not return specific contacts

SOLVE

Hi there,
 
Recently I discovered that the function hubspotClient.crm.contacts.searchApi.doSearch does not always find specific customers, even if they exist.

That means that our codes evaluates that the customer does not exist and therefore it must create the customer and uses hubspotClient.crm.contacts.basicApi.create, but then when it does this it finds the customer already exists and responds with an error.
 
We do the check using the inserted email address. I can confirm that the used email address is identical to the email address in the users account.
 
This is a concern because we experience this occasionally with various email addresses.
 
I have additionally checked this using the api:
 
POST: crm/v3/objects/contacts/search 
{ "filterGroups":
[
{ "filters":
[
{
"propertyName": "email",
"operator": "EQ",
"value": "some-email-address"
}
]
}
],
"properties": [
"createdate", "email", "firstname", "lastname", "hs_object_id", "lastmodifieddate"
]
}
 
If I use the specific email address that I know does exist in our hubspot contacts list, the api returns
{
"total": 0,
"results": []

 
Last bit of informatiom, it appears for the user in question, they have a list of 7 email addresses in their account which contains duplicates. Some duplicate emails return results, others don't.
 
Is this a scope issue? Operator issue?
 
Thank you for your time.
 
P.S. tried to insert code in code block but upon posting, I got an error. Sorry for the unformatted code.

0 Upvotes
1 Accepted solution
Jaycee_Lewis
Solution
Community Manager
Community Manager

doSearch does not return specific contacts

SOLVE

Hey, @IZolas 👋 Thanks for your post and for including your details. No worries about the formatting.

I have a few questions. 

  • You mentioned “customer” and “user”. This is regarding a Contact record, correct? Not one of the users in your portal? 
  • Are you saying that even if you search by the “primary email address” you are not getting the expected response? Or only when you try to search for one of the additional emails?

I ask because secondary emails (non-primary) are stored in the Contact property called `hs_additional_emails`

 

Thanks for the additional details! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

View solution in original post

3 Replies 3
IZolas
Participant

doSearch does not return specific contacts

SOLVE

Hi @Jaycee_Lewis 

 

To answer your questions:

 

  • You mentioned “customer” and “user”. This is regarding a Contact record, correct? Not one of the users in your portal? 
    • It is a contact
  • Are you saying that even if you search by the “primary email address” you are not getting the expected response? Or only when you try to search for one of the additional emails?
    • At the moment, our setup will receive whatever email the user inserts, then we use the hubspot dependancy which provides this function hubspotClient.crm.contacts.searchApi.doSearch. As I understood, this search is supposed to look at any listed email address. But perhaps I am mistaken.

While I wait for your response, I will take a look at 'hs_additional_emails` and whether the hubspotClient.crm.contacts.searchApi.doSearch considers additionally listed email address. I may need to include it into the functions properties/filters.

 

Thanks again for your response.

0 Upvotes
Jaycee_Lewis
Solution
Community Manager
Community Manager

doSearch does not return specific contacts

SOLVE

Hey, @IZolas 👋 Thanks for your post and for including your details. No worries about the formatting.

I have a few questions. 

  • You mentioned “customer” and “user”. This is regarding a Contact record, correct? Not one of the users in your portal? 
  • Are you saying that even if you search by the “primary email address” you are not getting the expected response? Or only when you try to search for one of the additional emails?

I ask because secondary emails (non-primary) are stored in the Contact property called `hs_additional_emails`

 

Thanks for the additional details! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

IZolas
Participant

doSearch does not return specific contacts

SOLVE

Hi again @Jaycee_Lewis ,

 

I am writing to confirm that I should be making a check to both properties 'email'  and 'hs_additional_emails' to confirm if a contacts email address matches a contact within hubspot. This will return a response with the contacts id which can be used to update the contact where needed.

 

Thanks again for the lead!

0 Upvotes