GPT Action 库:Notion
简介
本页面为开发者构建特定应用程序的 GPT Action 提供说明和指南。在继续之前,请确保您已熟悉以下信息:
此特定的 GPT Action 提供了有关如何连接到 Notion 的概述。此 Action 接收用户的问题,使用 Notion 的搜索功能扫描相关的 Notion 页面,然后返回匹配页面的信息。
价值 + 示例业务用例
价值:用户现在可以利用 ChatGPT 的自然语言功能直接连接、查询和综合其 Notion 知识库。管理员可以明确地与集成共享页面以管理访问权限。
示例用例:
- 新员工寻求有关设置新系统的快速操作信息
- 支持代理需要快速从 Notion 检索信息,而无需阅读整个文档
- 用户希望综合信息并创建摘要或转换,以用于其工作中的其他方面
应用程序信息
应用程序关键链接
在开始之前,请查看应用程序的这些链接:
- 应用程序网站:https://www.notion.so/
- 应用程序 API 文档:https://developers.notion.com/reference/intro
- Notion 授权方法:https://developers.notion.com/docs/authorization
- 注意:Notion 仅允许与“公共集成”进行 OAuth。请参阅链接的文档以确定最适合您需求的方法。
应用程序先决条件
在开始之前,请确保在您的应用程序环境中完成以下步骤:
- 设置一个包含已填充页面的 Notion 工作区
- 通过 Notion 共享页面最适合与特定 Wiki 一起使用。考虑将您的知识库组织成一个 Wiki 或一组 Wiki
ChatGPT 步骤
自定义 GPT 说明
创建自定义 GPT 后,请将以下文本复制到“说明”面板中。有疑问吗?请查看 入门示例,了解此步骤的详细信息。
**背景**:您是一个乐于助人的聊天机器人,专注于从公司的 Notion 中检索信息。管理员已授予您访问多个有用 Notion 页面的权限。您的角色应类似于图书管理员,乐于回答和查找用户问题。
**说明**:
1. 使用搜索功能查找最相关的页面。
- 显示前 3 个页面。包含一个格式化的列表,其中包含:标题、最后编辑日期、作者。
- 标题应链接到该页面。
1.a. 如果没有相关页面,请改写搜索词并重试(最多 3 次)。
1.b. 如果重试后仍没有相关页面,则返回“抱歉,我找不到相关信息来帮助您回答这个问题”。
2. 打开最相关的文章,检索并阅读所有内容(包括任何相关的链接页面或数据库),然后提供一个 3 句话的摘要。在进行下一步之前,请务必提供一个简短的摘要。
3. 询问用户是否希望查看更多详细信息。如果用户同意,请提供详细信息,并提供探索更多相关页面的选项。
**附加说明**:
- 如果用户说“让我们开始吧”,请将自己介绍为 Notion 工作区的图书管理员,解释用户可以提供主题或问题,然后您将帮助查找相关页面。
- 如果页面上有数据库。在查看页面内容时,请务必读取数据库。
OpenAPI 架构
创建自定义 GPT 后,请将以下文本复制到“操作”面板中。有疑问吗?请查看 入门示例,了解此步骤的详细信息。
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
Authentication Instructions
Below are instructions on setting up authentication with this 3rd party application.
Pre-Action Steps
Before you set up authentication in ChatGPT, please take the following steps in the Notion.
- Go to the Notion Settings Page for your workspace
- Navigate to My Connections > Develop or Manage Integrations
- Create new Integration marked as Internal
- Locate your integration and find the API Key labeled: Internal Integration Secret. This is the bearer token for this integration.
NOTE! You need to share specific pages, databases, or wikis with the integration in order to access them in ChatGPT. Do this by selecting the ... button on the upper right of a page and select the appropriate connection.
NOTE! Notion allows integrations to leverage OAuth if they are marked as "Public." Review Notion's Auth Documentation to determine what integration path is best for your needs.
In ChatGPT
In ChatGPT, click on "Authentication" and choose "API Key". Enter in the information below.
- API Key: Use Internal Integration Secret from steps above
- Auth Type: Bearer
FAQ & Troubleshooting
- Search returns nothing If you don't see any pages returned when running a search, double check that you've shared relevant pages with the application from Notion
Are there integrations that you’d like us to prioritize? Are there errors in our integrations? File a PR or issue in our github, and we’ll take a look.