threads.get
Get a conversation thread.
Returns all messages in a conversation thread in chronological order, with pre-computed reply context (In-Reply-To, References, suggested subject and recipient). Automatically resolves merged threads.
openemail.threads.get(
mailboxId: string,
threadId: string,
options?: ThreadsGetOptions,
): PagePromise<ThreadView, MessageMeta>It calls GET /mailboxes/{mailboxId}/threads/{threadId}: Get a conversation thread in the API reference.
Example
for await (const messageMeta of openemail.threads.get(mailboxId, threadId)) {
// every item of every page (await the call instead for one page)
}Arguments
| Argument | Type | Description |
|---|---|---|
mailboxId | string | Mailbox ULID identifier. The path's {mailboxId}. |
threadId | string | Conversation thread identifier. The path's {threadId}. |
Options
The last argument, options, a ThreadsGetOptions, takes:
| Option | Type | Sent as | Description |
|---|---|---|---|
cursor | string | query cursor | Pagination cursor for next page of messages within thread |
limit | number | query limit | Maximum messages to return per page (max 200) |
label | string | query label | Folder context for the hidden-role filter — same label the listing was filtered by. Without it, and in every folder but Trash and Junk, members carrying the Trash or Junk label are excluded from both messages and messageCount; pass the Trash label to see exactly the trashed members, or the Junk label for the junked ones (a member in both is in Trash, not in Junk). This is the member set PATCH /messages's threadIds expands to, so a client that renders this view is acting on what it rendered. |
Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).
Answer
It is a listing, a PagePromise. Awaited, it is one page as the API answers it, ThreadView. Iterated with for await, it is every MessageMeta of every page, each page fetched as the loop reaches it.
Errors
| Status | What it means |
|---|---|
401 | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge |
404 | Mailbox or thread not found |
503 | temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |
A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.
Types
It names these types of the API, each on a page of its own: MessageMeta, ThreadView.