Querying a hubspot list


#1

I need to gate content on my website (external server to hubspot). To do this I would like to be able to query one of the lists on my hubspot account to see if the specific user machine trying to access my site is on that list and then react accordingly. I am at a complete loss as how to do that but surely it should be doable as after all gating content according to membership of a list is an obvious use of the hubspot subcription list. Any ideas out there as to how to do this gratefully received.

Method tried so far is to use a contextual marketing page on hubspot info.innerdrive.co.uk/subscriber to generate a page that decides if a user is SUBSCRIBED or NOTSUBSCRIBED, but when I try to parse that page from here https://www.innerdrive.co.uk/SubscriberPageTest.php the original page does not then recognise the users cookies and so returns NOTSUBSCRIBED the whole time. So frustrating


#2

Hi @MajorTed,

You might consider making a call to the 'Get a contact by its user token' endpoint and parsing the contact's list memberships. You could show/hide content based on whether or not the ID of your subscriber list appears in the contact's list membership array:


#3

Can I do this via a webpage. Where would I get the user token from without asking the user?


#4

Hi @MajorTed,

You can't call this endpoint directly via client side javascript, you can make it server side. The usertoken is just the value in the hubspotutk cookie, so in most cases you'd access it that way.