TW-6481: Add email subscription discovery, unsubscribe, and cleanup - #122
Merged
Conversation
qasim-nylas
marked this pull request as ready for review
August 18, 2026 04:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a provider-aware email subscription workflow to the CLI using the active/default grant—no grant ID is required.
nylas email subscriptions listdiscovers subscriptions from standardList-Unsubscribeheaders, groups matching messages, and reports sender, List-ID, message count, last-seen time, and action type.nylas email subscriptions unsubscribe <email-or-list-id>...previews and opens reviewed HTTPS or email unsubscribe actions without sending header-controlled requests from the user's mailbox.nylas email subscriptions cleanup <email-or-list-id>...separately moves matching messages to Trash or permanently deletes them with--permanent.--since,--limit,--all-folders,--dry-run,--yes, and structured output where applicable.Why
Users currently have to find newsletters individually, unsubscribe manually, and clean up old messages in a separate mail client. TW-6481 introduces a safe CLI-first workflow that works through Nylas grants rather than being Gmail-specific.
User experience and safety
mailto:actions for user review using the OS browser/mail composer.--all-foldersis provided.Provider support
https://mail.google.com/; Microsoft requiresMail.ReadWrite; Nylas hard delete must also be enabled in the Dashboard.Implementation notes
hard_delete=true.golang.org/x/text/casescall in notetaker output with standard-library Unicode capitalization sogovulncheckremains clean without adding or upgrading a dependency.Validation
make ci-fullgovulncheck(0 findings)Jira
TW-6481 (Epic: TW-6311)