Repository navigation
feat(gmail): Each user signs in, conversation, label and trash tools, register download_attachment (1.0.0) - #4180
Merged
crazywoola merged 2 commits intoNov 2, 2026
Conversation
… register download_attachment (1.0.0)
The agent retypes the sign-in link in its reply, and a long random state does not always survive that: in a real chat one character changed case, so the callback endpoint could not recognize the sign-in. The tool now returns <sign-in endpoint>?start=<12 lowercase characters without look-alikes>, and the endpoint redirects to the sign-in page it stored. The state and PKCE values go to the provider and back without passing through the agent.
This was referenced Nov 2, 2026
Closed
crazywoola
approved these changes
Nov 2, 2026
This branch was successfully deployed
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
Gmail 1.0.0 adds Each user signs in next to the existing OAuth credential, adds tools for conversations, labels, trash and drafts, and registers a tool that was never visible. It reuses the Google sign-in module from Google Calendar (#4173) and follows the same per-user design as the Microsoft and Atlassian plugins (#4163–#4171).
Fix:
download_attachmentwas never registered. The tool and its YAML were added in #2573, butprovider/dify-gmail.yamlnever listed it, so it didn't appear in Dify. It is listed now.Each user signs in
A new API-key style credential holds:
GET /gmail/callback.The flow is the same as Google Calendar's:
access_type=offlineandprompt=consent. The scopes are those of the OAuth credential plusopenid email.client_id | Dify user ID, and never appear in tool output.invalid_grantor a 401 starts a new sign-in.gmail_sign_outforgets the user's sign-in.The 9 original tools get the token through a small
connect()helper, so they work in both modes. Their names, parameters and output are otherwise unchanged, and existing OAuth credentials keep working.New tools (prefixed
gmail_: the new Agent rejects duplicate tool names across plugins)gmail_reply:• in the message's conversation (
threadId,In-Reply-To,References,Re:subject)•
reply_allcopies the other recipients but never you• replying to your own message answers its recipients
• optional HTML body
gmail_get_thread: every message with sender, date and text; HTML-only messages are reduced to text.gmail_trash_thread: trash or restore a whole conversation.gmail_trash_message(trash or restore),gmail_mark_read(read or unread)gmail_modify_labels:• add or remove labels by name or ID on a message or a whole conversation
• system labels (
INBOXto archive,STARRED,IMPORTANT, …)• optional
create_missinggmail_list_labels,gmail_create_label(nested with/),gmail_delete_label(system labels refused)gmail_get_draft,gmail_delete_draftsuccess/errorplus its fields).get_message,send_message, …) are kept to avoid breaking workflows. They clash with Outlook in one new-style Agent; the README documents this.Release Notes
Change Type
Screenshots / Videos
The README adds two chat screenshots:
Testing
pytest tests). They cover:invalid_grantor 401 starting a new link, an unticked permission, per-user isolation, secret rotation, the cancel and error pages, sign-out.gmail_reply: threading headers, reply-all without yourself, replying to your own message, the HTML part.search_messages).send_message).gmail_reply), labelled the conversation "Dify" (gmail_modify_labels, which created the label) and marked it read (gmail_mark_read).gmail_get_threadand the draft tools (unit tests only).Checklist