What can you do with it?

Gmail allows you to manage email communications programmatically. You can send emails with custom content, retrieve and read specific emails, search messages by various criteria including date ranges, manage email labels for organization, handle attachments properly, and modify message properties. This integration is perfect for email automation, inbox management, and communication workflows.

How to use it?

Basic Command Structure

/your-Gmail-connection [action] [required-parameters] [optional-parameters]

Parameters

Required:
  • action - The operation to perform with Gmail

Tools

Send Email

Send a new email message Parameters:
  • to (required) - Email address of the recipient
  • subject (required) - Subject of the email
  • body (required) - Content of the email
  • from (optional) - Sender email (defaults to authenticated user)
Example:
/your-Gmail-connection
action: send-email
to: jane@example.com
subject: Test Email from Automation
body: This is a test email sent from an automation. Cheers, Your Automation
Response:
{
  "id": "193d95c09459b8cc",
  "threadId": "193d95c09459b8cc",
  "labelIds": ["SENT"]
}

Get Email

Retrieve a specific email by ID Parameters:
  • message-id (required) - The ID of the email message
Example:
/your-Gmail-connection
action: get-email
message-id: 1936f3ac1c009ee
Response:
{
  "id": "193d6f3ac1c009ee",
  "threadId": "193d6f3ac1c009ee",
  "labelIds": ["CATEGORY_PERSONAL", "INBOX"],
  "snippet": "Hello, I'm a product manager working on...",
  "payload": {
    "headers": [
      {
        "name": "From",
        "value": "sender@example.com"
      },
      {
        "name": "Subject",
        "value": "Important Message"
      }
    ],
    "parts": [
      {
        "mimeType": "text/plain",
        "body": {
          "data": "[EMAIL CONTENT]"
        }
      }
    ]
  }
}

Search Emails

Search for emails using Gmail search syntax Parameters:
  • query (required) - Search query using Gmail search operators
  • label (optional) - Filter by specific label
  • from-date (optional) - Start date for search (Unix timestamp)
  • to-date (optional) - End date for search (Unix timestamp)
Example:
/your-Gmail-connection
action: search-emails
query: from:important@company.com
label: INBOX
from-date: 1388552400
to-date: 1391230800
Response:
{
  "messages": [
    {
      "id": "193d95c09459b8cc",
      "threadId": "193d95c09459b8cc"
    },
    {
      "id": "193d95bb59a438f6",
      "threadId": "193d95bb59a438f6"
    }
  ],
  "resultSizeEstimate": 2
}

List Labels

Get all labels in the Gmail account Parameters:
  • None required
Example:
/your-Gmail-connection
action: list-labels
Response:
{
  "labels": [
    {
      "id": "INBOX",
      "name": "INBOX",
      "type": "system"
    },
    {
      "id": "Label_1281231071272897110",
      "name": "Archived Clients",
      "type": "user"
    }
  ]
}

Add Label

Add a label to an email message Parameters:
  • message-id (required) - The ID of the email message
  • label-name (required) - Name of the label to add
Example:
/your-Gmail-connection
action: add-label
message-id: 1932ba8492f8c06e
label-name: Important
Response:
{
  "id": "1932ba8492f8c06e",
  "threadId": "1932ba8492f8c06e",
  "labelIds": [
    "IMPORTANT",
    "Label_1463535654189801540",
    "CATEGORY_PERSONAL"
  ]
}

Remove Label

Remove a label from an email message Parameters:
  • message-id (required) - The ID of the email message
  • label-name (required) - Name of the label to remove
Example:
/your-Gmail-connection
action: remove-label
message-id: 1932ba8492f8c06e
label-name: INBOX
Response:
{
  "id": "1932ba8492f8c06e",
  "threadId": "1932ba8492f8c06e",
  "labelIds": [
    "IMPORTANT",
    "CATEGORY_PERSONAL"
  ]
}

Move Email

Move an email to a different label/folder Parameters:
  • message-id (required) - The ID of the email message
  • to-label (required) - Destination label name
  • from-label (optional) - Label to remove (often INBOX)
Example:
/your-Gmail-connection
action: move-email
message-id: 1932ba8492f8c06e
to-label: Archived Clients
from-label: INBOX
Response:
{
  "id": "1932ba8492f8c06e",
  "labelIds": [
    "Label_1281231071272897110"
  ]
}

Handle Attachments

Download and save email attachments Parameters:
  • message-id (required) - The ID of the email with attachments
  • save-location (optional) - Where to save attachments
Example:
/your-Gmail-connection
action: handle-attachments
message-id: 193d6f3ac1c009ee
Response:
{
  "attachments": [
    {
      "filename": "document.pdf",
      "mimeType": "application/pdf",
      "size": 102400,
      "saved": true
    }
  ]
}

Notes

Email content is base64 encoded when sending. The ‘me’ keyword represents the authenticated user and should only be used for the sender, never the recipient. Date searches use Unix timestamps in seconds. Label searches are case-insensitive. Binary attachments (pdf, images, office files) must be handled with proper file type detection to avoid corruption. Gmail search operators like “from:”, “to:”, “subject:”, “has:attachment” can be used in search queries.