I am getting duplicate after tokens when doing GET request to conversation messages.
Example:
…/conversations/v3/conversations/threads/{threadId}/messages?limit=500&sort=createdAt&after={afterToken}
The first request returns a paging similar to above. The first and second requests return new data. Then the paging link is not updated after that and I am getting duplicates returned.
Hey, @MHenderson42
Welcome to our community! Thanks for your question.
Have you tried:
- Try limiting records to a smaller number, 5 or 10, and see if the issue persists. /conversations/v3/conversations/threads/{threadId}/messages?limit=10&sort=createdAt&after={afterToken}
- If no duplicates are returned, gradually increase the limit (to 50, 100, etc.) until you start seeing duplicates again.
- Another test to try is not passing the after token and see if duplicates start from first request itself or after a few batches.
This will give you a better idea of whether the issue is related to the ‘limit’ parameter, the ‘after’ token or is a different issue.
Thanks for the additional information! — Jaycee
I’ve tried a few things:
- Adding and removing sort
- Ascending and descending sort
- Setting the limit or removing to use default
The pattern goes like this:
- First GET request returns a handful of messages (with or without setting the limit)
- First GET request has after and link values
- Second GET request with after token returns a new token
- Third GET returns the same result as the second, including the token
I just noticed seomthing else testing with a new thread id. The second GET results returned an empty array, yet there’s a paging link. And the paging link duplicates the second GET request. It’s as if there’s no results left yet it’s setting a paging link anyway.