Requirements & Compatibility
- AnythingLLM Version: v1.12.1 or later.
- Security Model: Read-only actions execute without confirmation. Write/modification actions (marked with ✏️) require explicit approval.
Setup & Deployment
1. Retrieve Script
Download the Google Apps Script from:
https://github.com/Mintplex-Labs/anythingllm-gapps/blob/main/gmail/index.gs
2. Configure Google Apps Script
- Navigate to: Google Apps Script console -> New Project.
- Rename project (e.g.,
AnythingLLM Gmail Bridge). - Replace all contents of
Code.gswith the downloaded script. - Edit the security key configuration variable near the top:
const API_KEY = "YOUR_SECURE_RANDOM_STRING"; - Click Deploy > New deployment.
- Click the gear icon (Select type) -> Web App.
- Set parameters:
- Execute as:
Me - Who has access:
Anyone
- Execute as:
- Click Deploy, click Review Permissions, and authorize the script.
- Copy the generated
Deployment ID.
3. Configure AnythingLLM
- Input the
Deployment IDand the configuredAPI_KEYinto the AnythingLLM Gmail Agent settings page.
Capability Reference & Tool Commands
Search & Read
- Gmail Search
- Syntax: Standard Gmail operators (
is:inbox,is:unread,from:email,newer_than:7d). - Command:
@agent search for unread emails in my inbox about the project
- Syntax: Standard Gmail operators (
- Gmail Read Thread
- Action: Reads thread by ID; prompts before downloading attachments.
- Command:
@agent read the thread with ID <thread_id>
Draft Management
- Create Draft ✏️
- Command:
@agent create a draft email to john@example.com about the meeting tomorrow
- Command:
- Create Draft Reply ✏️
- Command:
@agent create a draft reply to thread <thread_id> thanking them for the update
- Command:
- Update Draft ✏️
- Command:
@agent update draft <draft_id> to change the subject to "Updated: Meeting"
- Command:
- Get Draft
- Command:
@agent show me the draft with ID <draft_id>
- Command:
- List Drafts
- Command:
@agent list my email drafts
- Command:
- Delete Draft ✏️
- Command:
@agent delete the draft with ID <draft_id>
- Command:
- Send Draft ✏️
- Command:
@agent send the draft with ID <draft_id>
- Command:
Send & Reply (Immediate)
- Send Email ✏️
- Command:
@agent send an email to john@example.com about the project update
- Command:
- Reply to Thread ✏️
- Command:
@agent reply to thread <thread_id> saying I agree with the proposal
- Command:
Thread Management
- Mark as Read ✏️
- Command:
@agent mark thread <thread_id> as read
- Command:
- Mark as Unread ✏️
- Command:
@agent mark thread <thread_id> as unread
- Command:
- Move to Trash ✏️
- Command:
@agent move thread <thread_id> to trash
- Command:
- Move to Archive ✏️
- Command:
@agent archive thread <thread_id>
- Command:
- Move to Inbox ✏️
- Command:
@agent move thread <thread_id> to inbox
- Command:
Account Administration
- Get Mailbox Stats
- Command:
@agent how many unread emails do I have?
- Command:
Maintenance Operations
Update the Script
- Open the project in the Google Apps Script console.
- Paste the updated script code into
Code.gs(maintain your configuredAPI_KEY). - Click Deploy > Manage deployments.
- Click the Pencil (Edit) icon.
- In the configuration dropdown, select New Version, enter a description, and click Deploy. Note: The Deployment ID remains unchanged; no configuration updates are needed in AnythingLLM.
Delete the Connection
- Open the project in the Google Apps Script console.
- Click Deploy > Manage deployments.
- Select the active deployment(s) and click Archive.
- Navigate to Project Settings and click Delete.