Here’s a pragmatic path to start modifying the Gmail source to fetch message attachments, plus how to test it locally. 1) Understand current Gmail connector and auth - The connector uses Google OAuth2.0 with gmail.readonly scope. You’ll need to keep OAuth and likely add logic to fetch attachment metadata and binary content per message (the doc lists existing streams like messages, messages_details; attachments aren’t listed yet) ([Gmail source](
https://docs.airbyte.com/integrations/sources/gmail)). - If you add config options (e.g., include attachments), update the spec and ensure the required scope still works or document any scope changes in the connector’s configuration section and changelog ([Gmail source](
https://docs.airbyte.com/integrations/sources/gmail)). 2) Pattern to follow for “file syncing” - For downloading files referenced by API records, use the FileUploader pattern from low-code connectors as a design reference. The Zendesk Support example shows a stream that: - Reads records (e.g., article_attachments) and extracts a download URL from the record - Uses a file_uploader block to fetch each file and determine a filename/path This pattern illustrates separation of metadata retrieval vs. file download and naming strategy, which you can mirror in Gmail (retrieve message parts, extract attachmentId and filename; then download the attachment content) ([File syncing usage example](
https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/file-syncing#usage-example), also mirrored in 1.7 and Next docs). 3) Implementation tips in code - Add a new stream for attachments (e.g., attachments or message_attachments) that: - Iterates messages (using existing messages/messages_details streams as inputs) - For each message, enumerates payload parts to find attachments, emitting metadata (message_id, filename, mimeType, size, attachment_id) - Option A: Emit only metadata and a signed/download URL - Option B: Also download binary content and either: - Emit as base64/string field in the record (may be large), or - Write files to a staging location similar to FileUploader semantics (destination must support files) - Add any necessary config flags (e.g., include_attachments: boolean) to the connector spec so users can opt-in. - Be mindful of pagination/quota and rate limits while iterating messages and fetching attachments. 4) Local build and test in the UI (no registry publish needed) - Build your modified connector image locally: - Using airbyte-ci: airbyte-ci connectors --name source-gmail build → produces airbyte/source-gmail:dev ([Developing locally](
https://docs.airbyte.com/platform/contributing-to-airbyte/developing-locally#connector-contributions), [Next](
https://docs.airbyte.com/platform/next/contributing-to-airbyte/developing-locally#connector-contributions)). - Load it into your abctl kind cluster: - kind load docker-image airbyte/source-gmail:dev -n airbyte-abctl (same docs as above). - In the UI at
http://localhost:8000: - Settings → Sources → set the Gmail connector version to dev and save. This makes the UI use your local image for syncs ([Developing locally](
https://docs.airbyte.com/platform/contributing-to-airbyte/developing-locally#connector-contributions)). - If you changed the spec (new config fields), refresh the cached spec by re-saving the version to dev in Settings so the UI shows your new fields ([Developing locally – spec caching](
https://docs.airbyte.com/platform/contributing-to-airbyte/developing-locally#connector-contributions)). - Alternative quick path: build/tag locally and add it as a Custom Connector in the UI (Settings → Sources → Custom Connector) to test without publishing ([Forum tip](
https://discuss.airbyte.io/t/1812)). 5) Contribute back (optional) - If you plan to upstream: - Open an issue first to align on approach and avoid overlap; then ensure tests pass, update metadata.yaml and docs/changelog per guidelines, and open a PR ([Change CDK connector – contribution process](
https://docs.airbyte.com/platform/contributing-to-airbyte/change-cdk-connector#contribution-process), same flow in 1.7/1.6 pages). - If implementing part of this as a low-code stream, document the streams and any new config. Follow semantic versioning and QA checks in the contribution docs (same sources above). Notes/uncertainties - The Gmail source docs don’t describe an existing attachments stream, nor exact code structure; you’ll need to add a new stream and the attachment download logic in the Gmail connector codebase. Use the FileUploader pattern as architectural guidance, adapting it to Gmail’s API specifics (message parts and attachments) ([File syncing usage example](
https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/file-syncing#usage-example)). - Ensure OAuth scope gmail.readonly is sufficient for attachment download; the docs state that scope for reading messages. If additional scope were needed, update the spec/docs accordingly ([Gmail source](
https://docs.airbyte.com/integrations/sources/gmail)). Testing checklist - Test with include_spam_and_trash both true/false to confirm coverage matches existing behavior while adding attachments ([Gmail source](
https://docs.airbyte.com/integrations/sources/gmail)). - Validate large attachments, MIME types, and rate limiting. - Verify connector spec changes appear in UI after cache refresh and that the dev image is used in syncs ([Developing locally](
https://docs.airbyte.com/platform/contributing-to-airbyte/developing-locally#connector-contributions)).