Gmail tools
The 12 Gmail operations your product runs on your customer's account through Connect. All of them use the same endpoint, POST /api/tools/{tool}/execute.
- List messagesGETLists the messages of the mailbox that match q and labelIds. Each item has only id and threadId: read the content with Get message. Pass nextPageToken as pageToken to read the next page.
- Get messageGETGets a message with its threadId, labelIds and snippet. With format full, the default, payload has the headers (From, To, Subject, Date, Message-ID) and the body parts, whose data is base64url encoded. Attachments come only as an attachmentId and are not downloaded.
- Get threadGETGets a conversation with all its messages. Each message has id, labelIds, snippet and, with format full, the default, the payload with the headers and the base64url encoded body parts.
- Send messagePOSTSends an email right away to the recipients in the To, Cc and Bcc headers of raw, and returns the sent message with id, threadId and labelIds. To reply inside a conversation, pass its threadId, keep the same Subject and set the In-Reply-To and References headers to the Message-ID of the message answered, which Get message returns in payload.headers.
- Update message labelsPOSTAdds and removes labels on a message and returns its labelIds. Remove UNREAD to mark it as read, remove INBOX to archive it, add STARRED to star it, or add TRASH to move it to the trash.
- List labelsGETLists the labels of the mailbox: the system labels, such as INBOX, SENT, DRAFT, UNREAD, STARRED and SPAM, and the labels the user created. The id of each one is what labelIds, addLabelIds and removeLabelIds take.
- Create labelPOSTCreates a label and returns it with its id, to apply with Update message labels. The name cannot be the name of a system label or of an existing label.
- List draftsGETLists the drafts of the mailbox. Each item has the draft id and a message with id and threadId: read the content with Get message using message.id. Pass nextPageToken as pageToken to read the next page.
- Create draftPOSTSaves an email as a draft without sending it, and returns the draft id and its message with id and threadId. Send it later with Send draft.
- Update draftPUTReplaces the whole email of a draft. The draft id stays and message.id changes. To edit the current text, read it first with Get message, format raw, using the message.id from List drafts.
- Send draftPOSTSends an existing draft right away to the recipients in its To, Cc and Bcc headers. The draft is deleted, and the sent message comes back with a new id and the SENT label.
- Delete draftDELETEDeletes a draft for good, without moving it to the trash.
See Connect applied to your product.
Try it for 15 days with no card, or walk our team through your use case.
