Filter contacts by custom field in Active Campaign

Hi,
I am using Node ActiveCampaign and would like to get contacts that have a specific value from a custom field. I tried several things and to no avail.

I tried using search more without success.

Does anyone ever manage to do this?

Hi @Edson_Rodrigues, I am sorry to hear you’re having trouble here. I just took a look at the respective API documentation from ActiveCampaign and they don’t seem to offer a way to filter results by custom fields. So n8n would not be able to send such a search request to ActiveCampaign either I am afraid.

I am not familiar with ActiveCampaign, but seeing the node offers an option to filter by List ID, are you perhaps able to add the contacts in question to a specific list through Active Campaign? You would then be able to fetch the Contacts from that list through n8n.

Hello @MutedJam
Thanks for the help, really this is the filter you don’t have in the API.

I got another alternative so I don’t need to use this filter.
But thanks anyway.

:slight_smile:

1 Like

@Edson_Rodrigues What was the alternative solution you found?

comic for reference: xkcd: Wisdom of the Ancients

I found a possible solution:

In my case, the custom field in ActiveCampaign is holding a unique ID from another system, and I’m trying to look up the ActiveCampaign contact using this ID.

To do so, you can use this method from the ActiveCampaign API:

Your URL will look something like this:

https://yourCompany.api-us1.com/api/3/fieldValues?filters[fieldid]=123&filters[val]=abcd1234

This will give you a response like this:

{
“fieldValues”:
[
{
“cdate”: “2024-04-19T13:18:52-05:00”,
“contact”: “12345”,
“created_by”: null,
“field”: “123”,
“id”: “1515151”,
“links”:
{
“field”: “https://yourCompany.api-us1.com/api/3/fieldValues/1515151/field”,
“owner”: “https://yourCompany.api-us1.com/api/3/fieldValues/1515151/owner”
},
“owner”: “12345”,
“udate”: “2024-04-19T13:18:52-05:00”,
“updated_by”: null,
“value”: “abcd1234”
}
],
“meta”:
{
“total”: “1”
}
}

Because this response gives me the contact ID (fieldValues[0].contact), I can then use that in other API methods, like get contact or update contact:

Hope this helps,

Ian Melchior