Repository navigation
feat(inboxes): add the inboxes endpoints and inbox webhook events - #119
AntoniosBarotsis merged 21 commits into
Conversation
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
No issues found across 5 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Adds the Inboxes SDK (26 endpoints, types, and 14 inbox webhook events) plus a version bump. Needs human sign-off because the PR depends on an unreleased upstream API change for label-id fields and adds a large public contract surface.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 3 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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Requires human review: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 4 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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
Add InboxesSvc with the 26 /inboxes operations: inboxes, agent settings, labels, threads, thread emails and drafts.
Add InboxEvent and InboxEventType for the 14 inbox events, and count them in events_up_to_date.
The API removed label_id. Use add_label_ids and remove_label_ids.
Create and update draft accept attachments with content, filename and content_type. Drafts, draft list items and the draft in inbox.draft.* events return attachments.
Follow the spec audit: no file count limit on draft attachments, send draft requirements, reply_all recipients, cursor and update order notes.
Create draft, send draft, reply and forward accept with_idempotency_key, the same way as emails.send. send_draft takes a SendInboxDraftOptions.
with_header works as on emails.send. send_draft sends a body only when headers are set.
Idempotency replays only a successful response, header name and value rules, reply and forward attachment rules. Add clear_attachments to the draft update.
Follow resend-openapi #137 and resend-node 7943103: - Every inbox route takes the Inbox ID or the inbox email address, and `inbox_path` percent-encodes it. - Agent: `enabled_actions` is now `actions`, `ArchiveThread` and `DeleteThread` are now `Archive` and `MoveToTrash`, and `tone` is the `InboxAgentTone` enum of the four presets. - Add `add_thread_labels`, `set_thread_labels` and `remove_thread_label`. `UpdateInboxThreadOptions` loses `with_add_label_ids` and `with_remove_label_ids`. - `update_draft` returns `UpdateInboxDraftResponse` with only `object` and `id`. - Search results lose `highlights`. - `Inbox` adds `updated_at`, and `InboxListItem` adds `created_at` and `updated_at`. - Reply and forward no longer cap attachments at 10 files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c850a08 to
f182c0a
Compare
There was a problem hiding this comment.
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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
The `inbox` object in `inbox.created` and `inbox.updated` events is the same inbox object that the API returns, which now has `updated_at`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 3 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 2 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (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: Adds the Inboxes API client and inbox webhook event types, but a dismissed P1 double-encoding bug in get/update/delete still appears in the diff, so human review is needed before shipping.
View guided diff | Re-trigger cubic
Summary
This PR adds the Inboxes API to the Rust SDK.
resend.inboxesis a newInboxesSvcwith the 29/inboxesoperations. The nested resources use flat, prefixed methods, the same aswebhooks.list_events:create,list,get,update,delete.get_agent,update_agent.list_labels,create_label,update_label,delete_label.list_threads,search_threads,get_thread,update_thread,delete_thread.add_thread_labels,set_thread_labels,remove_thread_label.list_thread_emails,get_thread_email,reply_thread_email,forward_thread_email.list_drafts,create_draft,get_draft,update_draft,delete_draft,send_draft.ListOptions<T>.list_threadsandsearch_threadsalso take a filter struct. The struct sendsfolders,labels,from,to,ccandbccas comma-separated values, as the API requires.{ object, id }. Reply, forward and send draft return{ id }, the ID of the sent email.reply_thread_emailandforward_thread_emailaccept attachments. They useCreateAttachment, the same type asemails.send.inbox_pathpercent-encodes it.update_threadtakesreadandfolder. The folder is anUpdateInboxThreadFolder, becausesentcannot be set. Labels change throughadd_thread_labels(POST, 1 to 10 IDs),set_thread_labels(PUT, up to 100 IDs, an empty slice clears them) andremove_thread_label(DELETE). Each returns aListInboxThreadLabelsResponsewith every label on the thread.actions.InboxAgentActionhasArchiveandMoveToTrash, andtoneis theInboxAgentToneenum of the four presets.update_draftreturnsUpdateInboxDraftResponse, with onlyobjectandid.highlights.matched_email_idis the emailidthatlist_thread_emailsreturns.Inboxhasupdated_at, andInboxListItemhascreated_atandupdated_at.CreateInboxDraftAttachmentneedscontent,filenameandcontent_type, because the API stores each file on the draft. On update,with_attachmentsreplaces every attachment, and an empty list removes them all. Drafts, draft list items and the draft ininbox.draft.*events returnattachments.Idempotency-Keyheader (resend/monorepo#11768). They expose it the same way asemails.send:with_idempotency_keyon the options returns anIdempotent<T>.send_drafttakes aSendInboxDraftOptionsfor this, because the request has no body.headers(resend/monorepo#12509), throughwith_headeras onemails.send. Resend setsIn-Reply-To,ReferencesandReply-To, so the API returns a 422 for them.send_draftsends a body only when headers are set.UpdateInboxAgentOptionsandUpdateInboxDraftOptionshaveclear_*methods that sendnull, because the API clears a field onnull.EventandEventTypeget the 14inbox.*webhook events.InboxEventis an enum tagged bytype, because thedatashape changes with the event type.events_up_to_datenow counts the inbox events instead of skipping them.0.35.0, in its own commit. I leftCHANGELOG.mdfor the release.Depends on
Verification
cargo buildcargo fmt --checkcargo clippy --all-targets -- -Dwarningscargo clippy --all-targets --no-default-features --features rustls-tls -- -Dwarningscargo clippy --all-targets --features blocking -- -Dwarningscargo test --lib inbox: 29 offline tests pass, with and without--features blocking. They cover the request bodies, the query strings, the response shapes, and one payload per inbox webhook event.cargo test --lib events_up_to_date: passes against the live event types page with the 14 inbox events counted.The three clippy runs and
cargo fmt --checkpass.A live run through the methods against
https://api.resend.com, on a test inbox addressed by its email address. It restored every setting it changed and did not create or delete an inbox. All 33 checks passed:get,updateandlist: OK.updated_atand the list itemcreated_atandupdated_atare set. The name was restored.get_agentandupdate_agentwithInboxAgentTone::ExpandedCasualand[Archive, MoveToTrash]: OK, and the old values were restored.create_label,update_label,list_labels,delete_label: OK.add_thread_labels,set_thread_labelswith an empty slice,remove_thread_label: OK, each returned the thread labels. Removing a label that is not on the thread returned 200. An unknown label returned 404Label not found.get_thread,update_threadwithreadand a restore,list_threads, anddelete_threadon a thread in trash, which returneddeleted: false.search_threads: OK, andmatched_email_idis an emailidfromlist_thread_emails.list_thread_emails,get_thread_email,reply_thread_email,forward_thread_email: OK.create_draft,update_draft(onlyobjectandid),get_draft,list_drafts,send_draft,delete_draft: OK.Inbox not found.The crate tests that call the live API do not include inboxes, because the CI team may have no inbox to test with.
Not in this PR