Skip to content

Instantly share code, notes, and snippets.

@atymic
Created December 13, 2022 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atymic/1104ae32c2bfee6604e1eb6cf68c4989 to your computer and use it in GitHub Desktop.
Save atymic/1104ae32c2bfee6604e1eb6cf68c4989 to your computer and use it in GitHub Desktop.
<?php
use HubSpot\Client\Crm\Contacts\Model\Filter;
use HubSpot\Client\Crm\Contacts\Model\FilterGroup;
use HubSpot\Client\Crm\Contacts\Model\PublicObjectSearchRequest;
$intMobileFilter = (new Filter())
->setOperator('EQ')
->setPropertyName('hs_searchable_calculated_international_mobile_number')
->setValue('61476647930');
$intPhoneFilter = (new Filter())
->setOperator('EQ')
->setPropertyName('hs_searchable_calculated_international_phone_number')
->setValue('61476647930');
$intMobileFilterGroup = (new FilterGroup())->setFilters([$intMobileFilter]);
$intPhoneFilterGroup = (new FilterGroup())->setFilters([$intPhoneFilter]);
$searchRequest = (new PublicObjectSearchRequest())
->setFilterGroups([
$intMobileFilterGroup,
$intPhoneFilterGroup,
])
->setProperties(['hs_object_id']);
$contactsPage = $client->crm()->contacts()->searchApi()->doSearch($searchRequest);
$contactId = $contactsPage->getResults(); // Empty Array, no results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment