本页面为开发者构建特定应用程序的 GPT Action 提供说明和指南。在继续之前,请务必先熟悉以下信息
这个特定的 GPT Action 概述了如何连接到 Notion。此 Action 接受用户的问题,使用 Notion 的搜索功能扫描相关的 Notion 页面,然后返回匹配页面的信息。
价值:用户现在可以利用 ChatGPT 的自然语言能力,直接连接、查询和综合他们在 Notion 中的知识。管理员可以明确地与集成共享页面以管理访问权限。
示例用例:
在开始之前,请查看来自应用程序的以下链接
在开始之前,请确保在您的应用程序环境中完成以下步骤
创建自定义 GPT 后,将以下文本复制到“说明”面板中。有问题?查看入门示例,了解此步骤的详细工作原理。
**Context**: You are a helpful chatbot focussed on retrieving information from a company's Notion. An administrator has given you access to a number of useful Notion pages. You are to act similar to a librarian and be helpful answering and finding answers for users' questions.
**Instructions**:
1. Use the search functionality to find the most relevant page or pages.
- Display the top 3 pages. Include a formatted list containing: Title, Last Edit Date, Author.
- The Title should be a link to that page.
1.a. If there are no relevant pages, reword the search and try again (up to 3x)
1.b. If there are no relevant pages after retries, return "I'm sorry, I cannot find the right info to help you with that question"
2. Open the most relevant article, retrieve and read all of the contents (including any relevant linked pages or databases), and provide a 3 sentence summary. Always provide a quick summary before moving to the next step.
3. Ask the user if they'd like to see more detail. If yes, provide it and offer to explore more relevant pages.
**Additional Notes**:
- If the user says "Let's get started", introduce yourself as a librarian for the Notion workspace, explain that the user can provide a topic or question, and that you will help to look for relevant pages.
- If there is a database on the page. Always read the database when looking at page contents.
创建自定义 GPT 后,将以下文本复制到“Actions”面板中。有问题?查看入门示例,了解此步骤的详细工作原理。
openapi: 3.1.0
info:
title: Notion API
description: API for interacting with Notion's pages, databases, and users.
version: 1.0.0
servers:
- url: https://api.notion.com/v1
description: Main Notion API server
paths:
/users:
get:
operationId: listAllUsers
summary: List all users
parameters:
- name: Notion-Version
in: header
required: true
schema:
type: string
example: 2022-06-28
constant: 2022-06-28
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
results:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
avatar_url:
type: string
type:
type: string
/blocks/{block_id}/children:
get:
operationId: retrieveBlockChildren
summary: Retrieve block children
parameters:
- name: block_id
in: path
required: true
schema:
type: string
- name: Notion-Version
in: header
required: true
schema:
type: string
example: 2022-06-28
constant: 2022-06-28
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
object:
type: string
results:
type: array
items:
type: object
properties:
id:
type: string
type:
type: string
has_children:
type: boolean
/comments:
get:
operationId: retrieveComments
summary: Retrieve comments
parameters:
- name: Notion-Version
in: header
required: true
schema:
type: string
example: 2022-06-28
constant: 2022-06-28
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
results:
type: array
items:
type: object
properties:
id:
type: string
text:
type: string
created_time:
type: string
format: date-time
created_by:
type: object
properties:
id:
type: string
name:
type: string
/pages/{page_id}/properties/{property_id}:
get:
operationId: retrievePagePropertyItem
summary: Retrieve a page property item
parameters:
- name: page_id
in: path
required: true
schema:
type: string
- name: property_id
in: path
required: true
schema:
type: string
- name: Notion-Version
in: header
required: true
schema:
type: string
example: 2022-06-28
constant: 2022-06-28
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
id:
type: string
type:
type: string
title:
type: array
items:
type: object
properties:
type:
type: string
text:
type: object
properties:
content:
type: string
/databases/{database_id}/query:
post:
operationId: queryDatabase
summary: Query a database
parameters:
- name: database_id
in: path
required: true
schema:
type: string
- name: Notion-Version
in: header
required: true
schema:
type: string
example: 2022-06-28
constant: 2022-06-28
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
filter:
type: object
sorts:
type: array
items:
type: object
start_cursor:
type: string
page_size:
type: integer
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
object:
type: string
results:
type: array
items:
type: object
next_cursor:
type: string
has_more:
type: boolean
/search:
post:
operationId: search
summary: Search
parameters:
- name: Notion-Version
in: header
required: true
schema:
type: string
example: 2022-06-28
constant: 2022-06-28
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
query:
type: string
filter:
type: object
properties:
value:
type: string
property:
type: string
sort:
type: object
properties:
direction:
type: string
timestamp:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
object:
type: string
results:
type: array
items:
type: object
properties:
id:
type: string
title:
type: array
items:
type: object
properties:
type:
type: string
text:
type: object
properties:
content:
type: string
以下是关于使用此第三方应用程序设置身份验证的说明。
在 ChatGPT 中设置身份验证之前,请在 Notion 中执行以下步骤。
注意! 您需要与集成共享特定的页面、数据库或 Wiki,才能在 ChatGPT 中访问它们。通过选择页面右上角的“...”按钮并选择适当的连接来执行此操作。
注意! 如果 Notion 集成被标记为“公共”,则允许它们利用 OAuth。查看 Notion 的身份验证文档,以确定哪种集成路径最适合您的需求。
在 ChatGPT 中,单击“身份验证”,然后选择 “API 密钥”。输入以下信息。
您希望我们优先考虑哪些集成?我们的集成中是否存在错误?在我们的 github 中提交 PR 或 issue,我们将进行查看。