APIs & Integrations

cimar007
Participant

Searching contact by phone number (different formats)

Hey guys. I am searching contacts by Phone Number using the api (https://api.hubapi.com/crm/v3/objects/contacts/search?)
 

It is saved in various format in my CRM.
So when I do the search if the format matches it returns otherwise it does not.
 
How do I solve this ? 
 
Scenario 1: In my CRM phone is saved as +1 (617) 000-0000 
it does not return the contact if I search as 6170000000
 
Scenario 1: In my CRM phone is saved as (617) 0000000 
it does not return the contact if I search as 6170000000
6 Replies 6
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Searching contact by phone number (different formats)

Hi @cimar007 ,

Try the below code in your php:

$hapikey = 'XXXXXXXXX-XXX-XXXX-XXXX-XXXXXXXXXXXX';

$args['url'] = 'https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey='.$hapikey;
$args['data'] = json_encode([
"filterGroups"=>[
[
"filters"=>[
[
"propertyName" => "hs_searchable_calculated_phone_number",
"operator" => "EQ",
"value" => '6170000000'
]
]
]
]
]);

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

cooperelias
Contributor

Searching contact by phone number (different formats)

Hi @cimar007 -  there are several hidden contact properties for searchable phone number values. Here are the property names I found that you might want to try using for your search:

 

"name": "hs_searchable_calculated_international_mobile_number",
"label": "Calculated Mobile Number with country code"
 
"name": "hs_searchable_calculated_international_phone_number",
"label": "Calculated Phone Number with country code"
 
"name": "hs_searchable_calculated_mobile_number",
"label": "Calculated Mobile Number without country code"
 
"name": "hs_searchable_calculated_phone_number",
"label": "Calculated Phone Number without country code"
 
I was able to do an or search using the phone and mobile phone options and have had good results so far.
AChubak
Contributor

Searching contact by phone number (different formats)

hi @cooperelias is there docs for this somewhere? I've looked at many hubspot docs and couldn't find where this was written. 

0 Upvotes
cooperelias
Contributor

Searching contact by phone number (different formats)

Not that I am aware of. I found those properties just by using the Properties API to read all contact properties.

0 Upvotes
EM9
Participant

Searching contact by phone number (different formats)

Hi,

 

I tried this, but I don't get the correct results, as it seems the international field is not correctly filled. Can you help? @PamCotton 

 

EM9_0-1670640831080.png

EM9_1-1670640840795.png

EM9_2-1670640856430.png

 

0 Upvotes
PamCotton
Community Manager
Community Manager

Searching contact by phone number (different formats)

Hello @cimar007 Just confirm you are using our CRM Search API? 

This provides the means of using operators to refine searches. Operators include:

  • equal to
  • not equal to
  • greater than
  • less than
  • has property value
  • and many more...
These offer greater control over querying objects in your portal and may work better for your phone search.
 
I hope this helps.
 
Pam
Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Upvotes