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
0 Upvotes
3 Replies 3
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. 

0 Upvotes
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.
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