本页面为开发者构建特定应用程序的 GPT Action 提供说明和指南。在继续之前,请务必先熟悉以下信息
此 GPT Action 概述了如何连接到 Google Gmail,Google 的个人或商务专用和安全电子邮件服务。此 Action 连接到 Google Gmail API,可以读取、发送、列出和起草授权帐户中的电子邮件。
价值:Gmail GPT 将作为强大的工具,用于简化沟通流程、改善客户互动并优化资源分配。
示例用例:
在开始之前,请查看来自应用程序的以下链接
在开始之前,请确保您拥有 Google Cloud 帐户并且已启用 Gmail API
创建自定义 GPT 后,将以下文本复制到“Instructions(指令)”面板中。有问题?请查看入门示例,了解此步骤如何更详细地工作。
**Context**
Act as an email assistant designed to enhance user interaction with emails in various ways. This GPT can assist with productivity by summarizing emails/threads, identifying next steps/follow-ups, drafting or sending pre-written responses, and programmatically interacting with third-party tools (e.g., Notion to-dos, Slack channel summaries, data extraction for responses). This GPT has full scope access to the GMAIL OAuth 2.0 API, capable of reading, composing, sending, and permanently deleting emails from Gmail.
**Instructions**
- Always conclude an email by signing off with logged in user's name, unless otherwise stated.
- Verify that the email data is correctly encoded in the required format (e.g., base64 for the message body).
- Email Encoding Process: 1\ Construct the email message in RFC 2822 format. 2\ Base64 encode the email message. 3\Send the encoded message using the API.
- If not specified, sign all emails with the user name.
- API Usage: After answering the user's question, do not call the Google API again until another question is asked.
- All emails created, draft or sent, should be in plain text.
- Ensure that the email format is clean and is formatted as if someone sent the email from their own inbox. Once a draft is created or email sent, display a message to the user confirming that the draft is ready or the email is sent.
- Check that the "to" email address is valid and in the correct format. It should be in the format "recipient@example.com".
- Only provide summaries of existing emails; do not fabricate email content.
- Professionalism: Behave professionally, providing clear and concise responses.
- Clarification: Ask for clarification when needed to ensure accuracy and completeness in fulfilling user requests.
- Privacy and Security: Respect user privacy and handle all data securely.
创建自定义 GPT 后,将以下文本复制到“Actions(操作)”面板中。有问题?请查看入门示例,了解此步骤如何更详细地工作。
openapi: 3.1.0
info:
title: Gmail Email API
version: 1.0.0
description: API to read, write, and send emails in a Gmail account.
servers:
- url: https://gmail.googleapis.com
paths:
/gmail/v1/users/{userId}/messages:
get:
summary: List All Emails
description: Lists all the emails in the user's mailbox.
operationId: listAllEmails
parameters:
- name: userId
in: path
required: true
schema:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
- name: q
in: query
schema:
type: string
description: Query string to filter messages (optional).
- name: pageToken
in: query
schema:
type: string
description: Token to retrieve a specific page of results in the list.
- name: maxResults
in: query
schema:
type: integer
format: int32
description: Maximum number of messages to return.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/MessageList'
'400':
description: Bad Request
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
'500':
description: Internal Server Error
/gmail/v1/users/{userId}/messages/send:
post:
summary: Send Email
description: Sends a new email.
operationId: sendEmail
parameters:
- name: userId
in: path
required: true
schema:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
responses:
'200':
description: Email sent successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'400':
description: Bad Request
'401':
description: Unauthorized
'403':
description: Forbidden
'500':
description: Internal Server Error
/gmail/v1/users/{userId}/messages/{id}:
get:
summary: Read Email
description: Gets the full email content including headers and body.
operationId: readEmail
parameters:
- name: userId
in: path
required: true
schema:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
- name: id
in: path
required: true
schema:
type: string
description: The ID of the email to retrieve.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/FullMessage'
'400':
description: Bad Request
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
'500':
description: Internal Server Error
/gmail/v1/users/{userId}/messages/{id}/modify:
post:
summary: Modify Label
description: Modify labels of an email.
operationId: modifyLabels
parameters:
- name: userId
in: path
required: true
schema:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
- name: id
in: path
required: true
schema:
type: string
description: The ID of the email to change labels.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LabelModification'
responses:
'200':
description: Labels modified successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'400':
description: Bad Request
'401':
description: Unauthorized
'403':
description: Forbidden
'500':
description: Internal Server Error
/gmail/v1/users/{userId}/drafts:
post:
summary: Create Draft
description: Creates a new email draft.
operationId: createDraft
parameters:
- name: userId
in: path
required: true
schema:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Draft'
responses:
'200':
description: Draft created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Draft'
'400':
description: Bad Request
'401':
description: Unauthorized
'403':
description: Forbidden
'500':
description: Internal Server Error
/gmail/v1/users/{userId}/drafts/send:
post:
summary: Send Draft
description: Sends an existing email draft.
operationId: sendDraft
parameters:
- name: userId
in: path
required: true
schema:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SendDraftRequest'
responses:
'200':
description: Draft sent successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'400':
description: Bad Request
'401':
description: Unauthorized
'403':
description: Forbidden
'500':
description: Internal Server Error
components:
schemas:
MessageList:
type: object
properties:
messages:
type: array
items:
$ref: '#/components/schemas/Message'
nextPageToken:
type: string
Message:
type: object
properties:
id:
type: string
threadId:
type: string
labelIds:
type: array
items:
type: string
addLabelIds:
type: array
items:
type: string
removeLabelIds:
type: array
items:
type: string
snippet:
type: string
raw:
type: string
format: byte
description: The entire email message in an RFC 2822 formatted and base64url encoded string.
FullMessage:
type: object
properties:
id:
type: string
threadId:
type: string
labelIds:
type: array
items:
type: string
snippet:
type: string
payload:
type: object
properties:
headers:
type: array
items:
type: object
properties:
name:
type: string
value:
type: string
parts:
type: array
items:
type: object
properties:
mimeType:
type: string
body:
type: object
properties:
data:
type: string
LabelModification:
type: object
properties:
addLabelIds:
type: array
items:
type: string
removeLabelIds:
type: array
items:
type: string
Label:
type: object
properties:
addLabelIds:
type: array
items:
type: string
removeLabelIds:
type: array
items:
type: string
EmailDraft:
type: object
properties:
to:
type: array
items:
type: string
cc:
type: array
items:
type: string
bcc:
type: array
items:
type: string
subject:
type: string
body:
type: object
properties:
mimeType:
type: string
enum: [text/plain, text/html]
content:
type: string
Draft:
type: object
properties:
id:
type: string
message:
$ref: '#/components/schemas/Message'
SendDraftRequest:
type: object
properties:
draftId:
type: string
description: The ID of the draft to send.
userId:
type: string
description: The user's email address. Use "me" to indicate the authenticated user.
以下是关于如何使用此第三方应用程序设置身份验证的说明。有问题?请查看入门示例,了解此步骤如何更详细地工作。
在 ChatGPT 中设置身份验证之前,请在应用程序中执行以下步骤。
在 ChatGPT 中,单击“Authentication(身份验证)”,然后选择 “OAuth”。输入以下信息。
在 ChatGPT 中设置身份验证后,请按照应用程序中的以下步骤完成 Action。
您是否有希望我们优先考虑的集成?我们的集成中是否存在错误?在我们的 github 中提交 PR 或 issue,我们将查看。