Here's a funny one, which blows my mind at the moment. I am trying to get the user IDs of all users in a segment. About 2500 users. The segment was created using Intercom's search/filter. Here's how I grab the users (random segment ID):
https://api.intercom.io/users?per_page=60&segment_id=3baabac0c422f15fcfb7f760
This gives me 60 users and it works great. However, if I send the request again, I get 60 new users. I've confirmed that the 60 new users aren't in a different order as well, so they're randomly selected, I assume.
If we forget the segment_id
from the request, I can get a complete list of users, sorted and ordered if I want, like this:
https://api.intercom.io/users?per_page=60&sort=created_at&order=asc
I now have a list of 60 users, that will always be the same (because of created_at
and order by ascending).
What happens if we add the segment_id
back, so the request looks like this:
https://api.intercom.io/users?per_page=60&sort=created_at&order=asc&segment_id=3baabac0c422f15fcfb7f760
I get the exact same results as if I simply did the very first request. It completely ignores the sort and order. Completely. I've tried requesting 20 pages (1200 users), but I got so many duplicates because of the inconsistent results. This means I can never be 100% sure to get all the users, even if I go through all the pages.
I thought their API would tell me something about this, but at this point I honestly don't know what to do. So my question really is:
How do I order and sort a list of users from a segment using Intercom's API?