Hi everyone,
For one of my projects, I need to create a dynamic contact list via the API. I’ve used the API to develop my function, but for some reason the Api response returns an exception.
I get an error, but my list has been well created in the hubspot backoffice.
My project is on symfony
I’m using the hubspot/api-client 11.3
And my function code is :
public function createList($type, $year)
{
$listName = '[my-list] ' . $type['name'] . ' ' . $year;
// Manually create the filter structure
$filter = [
'filterType' => 'PROPERTY',
'property' => $type['slug'],
'operation' => [
'operationType' => 'STRING',
'operator' => 'IS_EQUAL_TO',
'value' => $year
]
];
// Create the filter branch
$filterBranch = [
'filterBranchOperator' => 'OR',
'filterBranchType' => 'OR',
'filterBranches' => [
[
'filterBranchOperator' => 'AND',
'filterBranchType' => 'AND',
'filters' => [$filter]
]
],
'filters' => []
];
// Create the ListCreateRequest
$listCreateRequest = new ListCreateRequest();
$listCreateRequest->setName($listName);
$listCreateRequest->setProcessingType('DYNAMIC');
$listCreateRequest->setFilterBranch($filterBranch);
$listCreateRequest->setObjectTypeId('0-1');
try {
$apiResponse = $this->hubspot->crm()->lists()->listsApi()->create($listCreateRequest);
return $apiResponse;
} catch (\Exception $e) {
$errorMessage = "Error creating list: " . $e->getMessage();
return $errorMessage;
}
}
My property type[“slug”] exist.
When I execute the function I get the error :
Error creating list: Invalid value ‘OR’ for ‘filter_branch_type’, must be one of 'ASSOCIATION
I try my best to change the filter_branch_type to ASSOCIATION, but then impossible to create my list.
So for the moment I’m ignoring the error, which doesn’t prevent the list from being created.
Thank you for your feedback


