Skip to content

feat(inboxes): filter thread list by folders, labels and read, add thread search - #1142

Merged
joaopcm merged 2 commits into
preview-inboxesfrom
feature/mes-2207-update-the-node-sdk-inbox-preview-with-the-thread-list
Oct 8, 2026
Merged

joaopcm merged 2 commits into
preview-inboxesfrom
feature/mes-2207-update-the-node-sdk-inbox-preview-with-the-thread-list

Conversation

@joaopcm

@joaopcm joaopcm commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

the inbox preview's threads.list still sends folder, query and label, which the public API stopped reading in resend-monorepo#11702. so threads.list({ inboxId, folder: 'archive' }) gets the inbox folder back, with no error. there's also no method for GET /inboxes/:inbox_id/threads/search.

MES-2207

what changed

await resend.inboxes.threads.list({
  inboxId,
  folders: ['inbox', 'archive'],
  labels: [labelId],
  read: false,
});

await resend.inboxes.threads.search({
  inboxId,
  query: 'invoice',
  from: ['[email protected]'],
  hasAttachment: true,
  startDate: '2026-09-01',
});
  • threads.list drops folder, query and label and takes folders, labels (label IDs) and read.
  • new threads.search takes the list filters plus query, from/to/cc/bcc, hasAttachment and startDate/endDate. each result is a thread plus matched_email_id and highlights (fragments with the matches wrapped in **).
  • InboxThread gets folder, which the API already returns.
  • arrays go out comma-separated (folders=inbox,archive), which is how the API parses them (z.string().transform(splitCommaList) in thread-filters.ts). the old repeated label= keys fail validation there.
  • buildInboxCursorUrl builds the query from the keys it gets instead of a fixed list, so list and search share it. drafts.list sends the same params as before.

release

breaking for preview users who pass folder, query or label. after merge, bump to 6.32.1-preview-inboxes.5 and push the tag to publish under the preview-inboxes dist-tag.


Summary by cubic

Updates the inbox preview thread list filters to match the public API and adds thread search.

threads.list now takes folders, labels, and read instead of the ignored folder, query, and label params, and InboxThread now includes folder. A new threads.search method hits GET /inboxes/:inbox_id/threads/search with the list filters plus query, sender/recipient, attachment, and date options; each result includes matched_email_id and highlights. Array options are sent comma-separated, matching API parsing, and the shared query builder now serializes params generically from the given options.

Breaking changes

  • Preview users passing folder, query, or label to threads.list must switch to the new filter names.
  • Bump to 6.32.1-preview-inboxes.5 and publish under the preview-inboxes dist-tag.

Written for commit b76fe42. Summary will update on new commits.

View guided diff

@joaopcm
joaopcm requested a review from a team as a code owner October 8, 2026 00:05
@joaopcm
joaopcm requested review from klotty and removed request for a team October 8, 2026 00:05
@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/resend@1142

commit: b76fe42

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

2 issues found across 10 files

Confidence score: 4/5

  • threads.ts adds a search operation that may require a permission existing production API keys lack, causing requests to fail. Confirm the required permission is available to those keys and documented.
  • build-inbox-cursor-query.ts turns empty labels or folders arrays into empty-valued query params, which the API may parse as an empty filter entry. Omit these params when the arrays are empty.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/inboxes/build-inbox-cursor-query.ts">

<violation number="1" location="src/inboxes/build-inbox-cursor-query.ts:19">
P3: An empty array joins to an empty string, so `labels: []` or `folders: []` now emits an empty-valued param (`?labels=`), and the API's `splitCommaList('')` produces an empty entry instead of seeing no filter. The previous `label` handling appended nothing for an empty array. Skip arrays with no items along with `undefined`.</violation>
</file>

<file name="src/inboxes/threads/threads.ts">

<violation number="1" location="src/inboxes/threads/threads.ts:50">
P2: Custom agent: **API Key Permission Check SDK Methods**

Confirm that production API keys used by this SDK have the permission required for the new `/inboxes/:inboxId/threads/search` operation. Resend documents broader access for non-send routes, so existing restricted keys could otherwise fail when consumers call `threads.search`.</violation>
</file>

Linked issue analysis

Linked issue: MES-2207: update the Node SDK inbox preview with the thread list filters and search

Status Acceptance criteria Notes
✅ Use folders, labels, and read for thread list filters ListInboxThreadsOptions exposes these filters, and the tests verify comma-separated arrays and false read values.
✅ Include folder on each inbox thread InboxThread now includes folder, and the list and search fixtures provide it.
✅ Add search with the specified filters and date options threads.search calls the search path and maps query, list filters, address filters, attachment, and dates.
✅ Return matched email IDs and search highlights Search results extend InboxThread with matched_email_id and typed highlights, including the tested subject fragment.
✅ Serialize search parameters in the API's expected format The query builder comma-joins arrays, preserves false values, and tests verify the search parameter names.

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread src/inboxes/threads/threads.ts Resolved
Comment thread src/inboxes/build-inbox-cursor-query.ts Resolved
@joaopcm joaopcm self-assigned this Oct 8, 2026
@joaopcm
joaopcm requested a review from isabellaaquino October 8, 2026 11:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 10 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Linked issue analysis

Linked issue: MES-2207: update the Node SDK inbox preview with the thread list filters and search

Status Acceptance criteria Notes
✅ Use folders, labels, and read for thread list filters ListInboxThreadsOptions exposes these filters, and the tests verify comma-separated arrays and false read values.
✅ Include folder on each inbox thread InboxThread now includes folder, and the list and search fixtures provide it.
✅ Add search with the specified filters and date options threads.search calls the search path and maps query, list filters, address filters, attachment, and dates.
✅ Return matched email IDs and search highlights Search results extend InboxThread with matched_email_id and typed highlights, including the tested subject fragment.
✅ Serialize search parameters in the API's expected format The query builder comma-joins arrays, preserves false values, and tests verify the search parameter names.

Requires human review: Breaks the preview threads.list public options (folder/query/label -> folders/labels/read) and adds a new threads.search method; the SDK contract change is the decisive factor.

View guided diff | Re-trigger cubic

Comment thread src/inboxes/build-inbox-cursor-query.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Breaks the preview threads.list options (folder/query/label replaced by folders/labels/read) and adds a new public threads.search method; accepting that SDK contract change requires human sign-off.

View guided diff | Re-trigger cubic

@joaopcm
joaopcm merged commit 3c9912c into preview-inboxes Oct 8, 2026
10 checks passed
@joaopcm
joaopcm deleted the feature/mes-2207-update-the-node-sdk-inbox-preview-with-the-thread-list branch October 8, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants