{
  "$id": "https://intentschema.org/profiles/com.google.gmail/communication.email.message.send.v1.json",
  "id": "org.intentschema.communication.email.message.send.v1@com.google.gmail.v1",
  "pins": "https://intentschema.org/intents/communication/email/message/send/v1.json",
  "title": "Gmail email send profile",
  "description": "Profile for sending email via the Gmail API. Pins target.system to `gmail`, adds Gmail-specific extensions (threadId for replies, labelIds for tagging), and bounds attachment sizes to the Gmail limit.",
  "result": {
    "type": "object",
    "properties": {
      "gmail": {
        "type": "object",
        "properties": {
          "historyId": {
            "type": "string",
            "description": "Gmail mailbox history id at the time of send."
          },
          "labelIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Labels applied to the sent message."
          }
        }
      }
    }
  },
  "constraints": {
    "properties": {
      "target": {
        "properties": {
          "system": {
            "const": "gmail"
          }
        },
        "required": [
          "system"
        ]
      },
      "object": {
        "properties": {
          "attachments": {
            "items": {
              "properties": {
                "size": {
                  "maximum": 26214400
                }
              }
            }
          }
        }
      },
      "gmail": {
        "type": "object",
        "properties": {
          "threadId": {
            "type": "string",
            "description": "Gmail thread identifier; set when this send belongs to an existing thread."
          },
          "labelIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Gmail labels to apply to the sent message."
          }
        }
      }
    }
  },
  "api": {
    "method": "POST",
    "path": "/gmail/v1/users/me/messages/send",
    "scopes": [
      "https://www.googleapis.com/auth/gmail.send"
    ],
    "docs": "https://developers.google.com/gmail/api/reference/rest/v1/users.messages/send",
    "params": {
      "object.to": "raw message To header (RFC 5321 addresses)",
      "object.cc": "raw message Cc header",
      "object.bcc": "raw message Bcc header",
      "object.from": "raw message From header",
      "object.subject": "raw message Subject header",
      "object.textBody": "raw message text/plain body part",
      "object.htmlBody": "raw message text/html body part",
      "object.attachments": "raw message MIME attachment parts",
      "idempotency_key": "raw message Message-ID header",
      "gmail.threadId": "threadId (query param or JSON field)",
      "gmail.labelIds": "labelIds (JSON field)"
    },
    "base_url": "https://gmail.googleapis.com"
  }
}
