Get ContactLists for contacts

dventulieri
Participant

I have a use case which requires showing all ContactLists a given email address or multiple email addresses belong to. To do so, I first get the Contact the email address is associated to and set the list-memberships param to true. This is done via the Contact API.

 

The response contains all of the contacts and their list memberships. I then set the Count in our app to the number of list-memberships returned and fetch all of those contact-lists by ID via the ContactList API.

 

However, the Contact API seems to return list-memberships that are NOT ContactLists. I noticed that when I enroll a contact into a Workflow, the contact gets added to new lists that are NOT ContactLists.

 

Is there a way to get ONLY the ContactLists a Contact belongs to? 

0 Upvotes
1 Accepted solution
JasminLin
Solution
HubSpot Employee
HubSpot Employee

Hey @dventulieri , the list-membership parameter will return list IDs that includes both contact lists and internal lists as you have observed. Internal lists are lists generated by our system that is used for things like workflow enrollment, so you would not get this sort of lists from using the Contact Lists API. 

 

Currently it's not possible to omit the internal lists from the list-membership parameter in the response. You can cross check the list IDs in list-membership of the Contacts API against the lists IDs you receive from the Contact Lists API https://developers.hubspot.com/docs/methods/lists/get_lists. 

View solution in original post

0 Upvotes
2 Replies 2
JasminLin
Solution
HubSpot Employee
HubSpot Employee

Hey @dventulieri , the list-membership parameter will return list IDs that includes both contact lists and internal lists as you have observed. Internal lists are lists generated by our system that is used for things like workflow enrollment, so you would not get this sort of lists from using the Contact Lists API. 

 

Currently it's not possible to omit the internal lists from the list-membership parameter in the response. You can cross check the list IDs in list-membership of the Contacts API against the lists IDs you receive from the Contact Lists API https://developers.hubspot.com/docs/methods/lists/get_lists. 

0 Upvotes
dventulieri
Participant

Hey @JasminLin . Got it, thanks for the quick response. It may be worth it for us to store the ContactList ids on our system to avoid the extra request each time. 

 

If I may request a feature, I feel like the the HubSpot API should offer the ability to get all ContactLists a list of email addresses belong to 🙂

 

Thanks again! 

0 Upvotes