Setup
- Go to Organization Settings > Connectors
- Click Add Connector and select Gmail
- Choose the access scope:
- Read only — Can list and read emails
- Read and write — Can list, read, and send emails
- Choose the authentication mode:
- Shared — Use a single shared account (the person configuring the resource provides credentials)
- Per-user — Each app user connects their own account
- Click Connect to Google to authorize access
major resource manage (CLI) or the web editor. Major generates a client in src/clients/.
Per-User Authentication
When you configure a Gmail resource for per-user authentication, end-users authenticate with their own Google accounts instead of using shared credentials.User Flow
- User accesses a deployed app that uses a per-user Gmail resource
- If they haven’t connected their account, Major redirects them to the
/connectpage - User clicks Connect Gmail and authorizes access to their own email
- User is returned to the app and can now use Gmail features
Managing Connections
Users can view and manage their connected OAuth accounts by clicking their profile photo in the bottom left and selecting Connected Accounts. From there, they can disconnect individual OAuth credentials or reconnect if access expires. Once disconnected, users must re-authorize via the/connect page if they want to use apps that require that connection.
Usage
Import the generated client and use the helper methods:Listing messages
operationName— A name for logging and debuggingoptions— Query options:q— Search query (e.g.,is:unread,from:alice@example.com,subject:important)maxResults— Maximum messages to return (1–500)pageToken— Token for pagination
messages— Array of message objects withid,threadId, andsnippetnextPageToken— Token to fetch the next page of results
Getting message details
operationName— A name for logging and debuggingoptions— Query options:id— Message ID (required)format— Response format:minimal,full, orraw
id— Message IDthreadId— Thread IDpayload— Message payload with headers and bodysnippet— Preview of message content
Sending messages
operationName— A name for logging and debuggingmessageBody— Message object with:to— Recipient email address (required)subject— Email subject (required)body— Email body (required)cc— CC recipient(s)bcc— BCC recipient(s)
id— The sent message’s IDthreadId— Thread ID- Full message object with all details
Low-level API
For operations not covered by helper methods, useinvoke() directly:
Supported API paths
User ID is typically
me to reference the authenticated user’s mailbox.Error handling
Common errors
Scope and permissions
When creating the resource, you choose between:- Read only —
GETrequests only - Read and write — Full read/write access including sending messages