APIs & Integrations

jreily
Member

Static Contact List - filter that selects from specific custom value list

I’d like be able create a static Contact List via the API containing a filter that selects a specific list of contacts (matching on a string custom property) – i.e. the contacts for the list would be any contact where its custom property value matches any of the IDs in the filter’s ID list.

I see that the operator SET_ANY can only be used for enumerator properties (not string properties). So I tried using the EQ operator with a semicolon-separated list of IDs (integers). I did’t think this would work since your documentation says EQ means “equal to the value specified” (implying one specific value), but I gave it a try anyway. That worked! I can see my new list with the several contacts in my list (“20759057;20759058”). But here are my questions:

  1. Is this an unorthodox use of the “EQ” filter operator, and will this result in future problems since your documentation implies that you can only use a single value?

  2. If it’s ok to use it like this, is there a limit to the size of the “value” fields. I could have hundreds, or maybe thousands of 8-digit IDs in my list.

Thank you.

0 Upvotes
8 Replies 8
Dadams
HubSpot Employee
HubSpot Employee

Static Contact List - filter that selects from specific custom value list

@jreily using multiple options (separate by semicolon) is supported for the EQ filter. There’s not a hard limit on the number of values you could include, but you’re going to see degraded performance for lists if you’re including thousands of values.

Can you tell me more about what you’re doing with the list and the values you’re trying to match?

0 Upvotes
jreily
Member

Static Contact List - filter that selects from specific custom value list

David,
We want to identify a group of contacts on our system that will be pushed to HubSpot where we can take advantage of the many HubSpot features. Each group would be based on a different criteria, e.g. industry, sales level, geo location, etc.

My thought is to use your Contact List API to maintain each group on HubSpot. Our account IDs are 8-9 digits, and I have defined a HubSpot contact custom property for that ID. I would then create the static Contact List by including all of the IDs in the EQ-operator filter value separated by semicolon.

My original thought was simply to use a “tags” contact custom property that could hold multiple space-separated string values which would identify the list(s) that the contact belongs to. E.g. “List_1 List_8”. But I think your Contact List better suits the purpose.

Is there a better way that you know of?
Thanks!

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Static Contact List - filter that selects from specific custom value list

Are you trying to match specific IDs or just include any contact that has an ID? If it’s the latter, you could just use the IS_NOT_EMPTY filter to catch any records with a value for your custom property.

0 Upvotes
jreily
Member

Static Contact List - filter that selects from specific custom value list

It’s specific IDs we want to match. We could also use the vid if that would make it any easier with some other method.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Static Contact List - filter that selects from specific custom value list

If you’re adding specific contacts to a list, it may work better to manually add the contacts to a static list:

Add existing contacts to a list | Contact Lists API

POST /contacts/v1/lists/:list_id/add

You can use list membership as criteria for other lists, so you could use a static list of manually added contacts as the criteria for your more complicated smart lists that have other criteria.

If you’re basing the list criteria on other properties (like you mentioned with industry, etc.), would it be possible to just populate those properties in HubSpot, and then build smart lists using those properties? Are you using some combination of your IDs and those other properties?

0 Upvotes
jreily
Member

Static Contact List - filter that selects from specific custom value list

Yes, adding contacts to an existing static list could be a solution, along with your other suggestions. So that raises another question. In order to add contacts to a list you have to have an existing list to add to. So when creating the initial Contact List, what sort of filter would I specify since it’s required?

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Static Contact List - filter that selects from specific custom value list

If you’re just going to be manually adding contacts to the static list, you wouldn’t need any filters. For static lists, filters only control the initial members of the list, so since you’re manually including specific contacts, you wouldn’t want any filters since you’d want the list to start out empty.

0 Upvotes
jreily
Member

Static Contact List - filter that selects from specific custom value list

Ok, I wasn’t sure if an actual initial filter was required. I tried creating a new list with an empty filter array and that work just fine. Thanks for all of your help, David!

0 Upvotes