I do have a company created in HubSpot and the code below works with the exception that no matter what I pass to setValue() it always returns the entire list of all companies on file instead only the one existing i.e. hubspot.com
tried it also with setPropertyName('hubspot') - same result.
Any ideas?
BTW. I asked the HubSpot community already but no one replied yet.
public function searchCompany($company_domain)
{
$filter = new \HubSpot\Client\Crm\Companies\Model\Filter();
$filter->setOperator('EQ')->setPropertyName('domain')->setValue($company_domain);
$searchRequest = new \HubSpot\Client\Crm\Companies\Model\PublicObjectSearchRequest();
$searchRequest->setFilterGroups([$filter]);
try {
$response = $this->hubspot_client->crm()->companies()->searchApi()->doSearch($searchRequest);
return $response;
} catch (ApiException $e) {
return $e->getMessage();
}
}