Filter list of contacts using php api

Your software
My Mautic version is:v4.4.5
My PHP version is:7.4.32
My Database type and version is:5.7.40

Your problem
My problem is: I would like to filter contacts belonging to a certain segment and then to send a custom email depending on user last activity.
if I write like this

$response      = $contactApi->getList('segment:newsletter', 0, 25);

I get a list (however besides of correct email addresses) I get also a list of contacts with empty emails

Array ( [id] => 6 [label] => Email [alias] => email [type] => email [group] => core [object] => lead [is_fixed] => 1 [properties] => a:0:{} [default_value] => [value] => [normalizedValue] => )

So I have tried to build a composed where clause from array of arrays like in documentattion

and any attempt to set a filter like

$where = [[ 'col' => 'segment', 'expr' => 'eq','val' => 'newsletter']] ; $response = $contactApi->getList($where, 0, 25);

fails. I have tried instead of “eq” expression to put “like” or “in” operator.
It seems that it’s not taking care of what ever I put in the $where array.

Not to mention that other filters like
$where = [[ ‘col’ => ‘segment’, ‘expr’ => ‘eq’,‘val’ => ‘newsletter’], [ ‘col’ => ‘email’, ‘expr’ => ‘isNotEmpty’]] ;

are not working either.

thank you,

no one ? what I am doing wrong on the filtering ?