I don’t find any mention of sorting / ordering in the documentation.
Without having to save everything in database and add the logic myself, is there a way to fetch all the threads by updated date?
Currently, If a thread have been created a long time ago but has a new message, it still does not pop on the first page of the request. I suppose the threads are sorted by Creation Date by default.
Well…not quite…different providers handle things differently and sometimes the implementation takes more time…the end goal is to make independent for the user…
Can you please provide me with a request ID? or a grant ID? so that the platform team can take a look at this?
But being a developer myself I don’t understand how it’s gonna help the dev team @nylas? Either it’s a feature that has not been dev yet, or a bug that I suppose appears on every request?
By using the request_id the platform team can traceback the error and see whether is a bug or something else…our accounts have everything enabled, so it’s better to test with the account that is generating problems…
The Nylas Threads API doesn’t currently support explicit sorting parameters for ordering threads by update date.
However, you can filter threads based on message activity using these query parameters:
latest_message_before - Returns threads with the latest message received before a specified timestamp
latest_message_after - Returns threads with the latest message received after a specified timestamp
This allows you to filter for threads with recent activity. For example:
GET /v3/grants/<NYLAS_GRANT_ID>/threads?latest_message_after=<UNIX_TIMESTAMP>
Each thread object includes latest_message_received_date and latest_message_sent_date fields, which track the most recent message activity in the thread.
To display threads sorted by most recent activity (similar to how email clients work), you’ll need to sort the returned thread objects client-side using the latest_message_received_date field.