After noticing some issues I began debugging the code and I realized that even if I just forced the code to delete the contacts in the list it would only delete some. I then placed the Get contacts in that list (/api.hubapi.com/contacts/v1/lists/XXX/contacts/all?hapikey=XXX) in the browser and it only shows about half of the people within the list. This would explain why my list would never empty.
Can someone explain why this is happening and how do I achieve my goal?
@whitfty1 when making the remove request, does the response contain any discarded or invalid vids?
How many records are you removing from the list? It can take several seconds to remove a large number of records, so if you’re checking immediately after the remove request the remove job may not be complete yet.
The count issue is related to the removal of the records. As long as a list is still processing and the records are still being removed, you may catch moments where the count of the records doesn’t line up with the current members of the list. You’d want to wait for the list to finish processing (you’ll see "processing": "DONE" in the metadata of the list) before using the numbers or members of the list.
But that is what I’m trying to say. In my case it has now been since 1/27 and the list still isn’t at 0, it still says 110. On top of that, prior to trying to delete, I use the endpoint that is supposed to get all contacts from a specific list and the numbers are different that the 110 in the list as it shows 77 unique uservids.
@whitfty1 can you send me a link to the list you’re looking at? If the list is done processing (which it should be after multiple days) then the count should line up with the number of records in the list, so if you’re seeing something different I’d need to see the list to take a look.
The List is called “Training Credit Eligible” and the list number is 2233. It shows that I have 110 contacts there, however, if you use the end point to get contacts in a list, you will see less unique vids.
Yes there are a few but even before I get to that with just the Get Contacts from list (function) the numbers are off. For example, the list currently has 110 contacts in it. When I plug in the end point (/api.hubapi.com/contacts/v1/lists/XXX/contacts/all?hapikey=XXX) and do a search for ’ “vids” ’ which should show all unique contacts, I only see 77 instances of that