Threads
A thread is a grouping of messages which are responses to the same original message. Threads display conversations in a logical and hierarchical way, depending on when the messages were sent and which of the messages in a chain they respond to.
Instead of displaying messages as individual and unrelated items, threads group related messages together based on any combination of the following:
- Subject line
- Message reference
- In-reply-to
- Recipients and senders
- Time and chronology
- Folder context
Threading provides an organized and coherent view of conversations, especially when several people are involved and there have been many replies. Threading allows participants to more easily follow the flow of a conversation, and understand the context and progression of the discussion.
Search threads
Search for threads by making a GET /v3/grants/<NYLAS_GRANT_ID>/threads request that includes any of the following query parameters:
subjectany_email,to,from,cc,bcclatest_message_before,latest_message_afterin,unread,starred,has_attachmentsearch_query_native
in:inbox returns a 400 error). Instead, you should use the folder ID with in to get the data you need.The search_query_native parameter allows you to add provider-specific query strings to your request for Google, Microsoft Graph, and EWS accounts. The value that you specify must be URL-encoded.
For more information and a list of provider considerations, see Searching with Nylas.
Threads rate limits
The Threads endpoints make a significant number of calls to the provider for each API request you make. Because of this, you might encounter rate limits when working with large threads of messages. Nylas recommends taking the following steps to avoid rate limits when using the Threads endpoints:
- Specify a lower
limitto reduce the number of results Nylas returns. - Add query parameters to your request to filter for specific threads.
- Use the
selectparameter to tell Nylas to return just the top-level fields you need.
GET /v3/grants/{grant_id}/threadsReturns all threads. For Microsoft, IMAP, iCloud, Yahoo, and EWS, threads are ordered reverse chronologically by the latest message received. For Google, thread ordering is not guaranteed to be revers...
GET /v3/grants/{grant_id}/threads/{thread_id}Returns the specified thread.
PUT /v3/grants/{grant_id}/threads/{thread_id}Updates the specified thread. When you make a PUT request, Nylas replaces all data in the nested object with the information included in your request. For more information, see Updating objects.
DELETE /v3/grants/{grant_id}/threads/{thread_id}Moves the specified thread to the Trash, including all messages in the thread.