跳到主要内容

Notion

要在 SkillFlaw 中使用 Notion 组件,你首先需要创建一个 Notion integration,并为其配置所需能力。本指南将带你完成设置流程,然后提供两个使用 Notion 组件的示例 flow。

设置 Notion 应用

要创建 Notion 应用,你需要具备以下条件:

  • 一个 Notion 账号,并可访问你希望使用该 integration 的 workspace。
  • 在 Notion workspace 中拥有创建和管理 integrations 的管理员权限。

创建 Notion Integration

  1. 打开 Notion Integrations 页面。
  2. 点击 New Integration
  3. 输入 integration 名称,然后选择你希望使用它的 workspace。
  4. 可选:根据你的需求启用所需的 Notion integration capabilities
  5. 点击 Submit 创建 integration。

配置 Integration Capabilities

创建 integration 后,你需要配置它的 capabilities,以定义它可以执行哪些操作以及可以访问哪些数据。

  1. 在 integration 设置页面中,进入 Capabilities 选项卡。
  2. 为你的 integration 启用所需能力。例如:
    • 如果 integration 需要从 Notion 读取数据,请启用 "Read content" capability。
    • 如果 integration 需要在 Notion 中创建新内容,请启用 "Insert content" capability。
    • 如果 integration 需要更新现有内容,请启用 "Update content" capability。
  3. 根据 integration 的需求配置用户信息访问级别。
  4. 保存更改。

获取 Integration Token

注意

你的 integration token 属于敏感信息。请妥善保管,切勿公开分享。请将其安全地存储在你的 SkillFlaw 配置或环境变量中。

要让 integration 能够通过 Notion 完成认证,你需要获取 integration token。

  1. 在 integration 设置页面中,进入 "Secrets" 选项卡。
  2. 复制 "Internal Integration Token" 的值。这个 token 将用于你的 integration 与 Notion 之间的认证。

授予 Integration 对 Notion Databases 的访问权限

为了让 integration 能够与 Notion databases 交互,你需要为它授予必须访问的具体 databases 的权限:

  1. 打开你希望 integration 访问的 Notion database。

  2. 点击 Share

  3. Invite 区域中,从列表中选择你的 integration。

  4. 点击 Invite,授予 integration 对该 database 的访问权限。

    如果你的 database 包含对其他 databases 的引用,你还需要为 integration 授予这些被引用 databases 的访问权限。 对 integration 需要访问的每个被引用 database 重复此步骤。

在 SkillFlaw 中使用 Notion 组件构建

当你完成 Notion integration 设置并为其授予所需 databases 的访问权限后,就可以开始在 SkillFlaw 中使用 Notion 组件:

  • Add Content to Page:将 markdown 文本转换为 Notion blocks,并追加到指定的 Notion 页面。
  • Create Page:在指定的 Notion database 中使用给定属性创建新页面。
  • List Database Properties:获取指定 Notion database 的属性列表。
  • List Pages:使用过滤和排序选项查询 Notion database。
  • List Users:获取 Notion workspace 中的用户列表。
  • Page Content Viewer:以纯文本形式获取 Notion 页面的内容。
  • Search:搜索所有已与 integration 共享的页面和 databases。你可以将结果过滤为页面或 databases,并指定排序方向。
  • Update Page Property:更新现有 Notion 页面的属性。

这些组件都可以输出 DataTool 数据类型

Notion 会议纪要 Agent

用于会议纪要的 Notion Agent 是一个 AI 驱动工具,可自动处理会议转录内容并更新你的 Notion workspace。它会识别会议中的任务、行动项和关键要点,然后在无需手动输入的情况下在 Notion 中创建新任务或更新现有任务。

要构建这个 flow,你需要具备以下内容:

注意

请将所有 key 和其他凭据视为敏感信息。使用安全引用方式,且不要公开分享。

此 flow 中使用的组件

Notion Meeting Agent Part 1

  • Meeting Transcript(text input):此组件允许用户将会议转录内容直接输入到 flow 中。
  • List Users(Notion component):从 Notion workspace 中获取用户列表。需要提供 Notion Secret(API key)。
  • List Databases(Notion component):搜索并列出 Notion workspace 中的所有 databases。需要以下输入:
    • Notion Secret(API key)
    • Query(可选)
    • Filter Type(默认:database)
    • Sort Direction
  • Prompt Template:此组件使用以下输入创建动态提示模板:
    • Meeting Transcript
    • List of Users
    • List of Databases
    • Current Date
  • Meeting Summarizer(Tool Calling Agent):分析会议转录内容并识别任务和行动项。需要以下输入:
    • System Prompt(来自 Prompt Template 组件)
    • Language Model(OpenAI)
    • Tools:
      • Notion Search
      • List Database Properties:获取指定 Notion database 的属性。输入需要 Database ID 和 Notion Secret(API key)。
      • Create Page:在 Notion database 中创建新页面。输入需要 Database ID、Properties(JSON)和 Notion Secret(API key)。
      • Update Page Property:更新现有 Notion 页面的属性。输入需要 Page ID、Notion Secret(API key)以及待更新属性。
      • Add Content to Page:将 markdown 文本转换为 Notion blocks,并追加到指定 Notion 页面。输入需要 Page/Block ID、Notion Secret(API key)和 Markdown 文本。

Notion Meeting Agent Part 2

  • Notion Agent(Tool Calling Agent):根据会议摘要在 Notion 中执行操作。需要以下输入:
    • System Prompt(来自第二个 Prompt Template 组件)
    • Language Model(OpenAI)
    • Tools:
      • List Database Properties:获取指定 Notion database 的属性。输入需要 Database ID 和 Notion Secret(API key)。
      • Create Page:在 Notion database 中创建新页面。输入需要 Database ID、Properties(JSON)和 Notion Secret(API key)。
      • Update Page Property:更新现有 Notion 页面的属性。输入需要 Page ID、Notion Secret(API key)以及待更新属性。
      • Add Content to Page:将 markdown 文本转换为 Notion blocks,并追加到指定 Notion 页面。输入需要 Page/Block ID、Notion Secret(API key)和 Markdown 文本。
  • Chat Output:在 Playground 中显示 Notion Agent 的最终输出。

Flow 处理过程

  1. 用户输入会议转录内容。
  2. Flow 获取 Notion 用户列表和 database 列表。
  3. 使用转录内容、用户列表、database 列表和当前日期生成提示词。
  4. Meeting Summarizer 分析转录内容并识别任务与行动项。
  5. Notion Agent 使用会议摘要执行以下操作:
    • 为新任务创建新页面
    • 为现有任务更新现有页面
    • 向页面添加会议纪要内容
  6. Chat Output 显示在 Notion 中执行操作的摘要。

运行 Notion 会议纪要 flow

  1. 手动创建一个 flow,或导入预构建的 flow JSON 文件:

    • 推荐: 下载 Meeting Agent flow JSON,然后将其导入到 SkillFlaw。
    • 创建一个空白 flow,然后将前面描述的组件添加到你的 flow 中,并按照 flow 图所示进行连接。
  2. 在相应组件中输入 Notion 和 OpenAI API keys。

  3. 将你的会议转录内容粘贴到 Meeting Transcript 组件中。

    为获得最佳效果,请使用详细的会议转录内容。输出质量取决于输入内容的完整程度。

  4. 点击 Chat Output 组件上的 Run component 运行 flow,或打开 Playground

  5. 查看输出,了解在你的 Notion workspace 中已执行的操作摘要。

  6. 可选:可以根据团队的具体需求对该 flow 进行自定义。 自定义此 flow 的方式包括:

    • 调整 system prompt,以改变 agent 的行为或上下文。
    • 根据你的具体需求添加或移除 Notion tools。
    • 修改 OpenAI 模型参数(例如 temperature),以调整 agent 的响应风格。

Notion 对话式 Agent

Notion Conversational Agent 是一个 AI 驱动助手,可通过自然语言对话与你的 Notion workspace 交互。该 flow 能通过聊天界面执行与 Notion 相关的任务,例如创建页面、搜索信息和管理内容。

Notion Components Toolkit

要构建这个 flow,你需要具备以下内容:

此 flow 中使用的组件

  • Chat Input:接收用户查询和命令
  • Chat Output:显示 agent 的响应
  • Language Model:使用 OpenAI 模型处理用户输入并生成响应
  • Tool Calling Agent:根据用户输入协调使用各类 Notion tools
  • Toolkit:将多个 Notion 专用 tools 组合成一个 toolkit
  • Notion Tools:用于与 Notion 交互的各类组件,包括:
    • List Users
    • List Database Properties
    • List Pages
    • Page Content Viewer
    • Create Page
    • Update Page Property
    • Add Content to Page
    • Search
  • Message History:存储对话历史
  • Prompt Template:为 agent 提供系统指令和上下文
  • Current Date:提供当前日期和时间作为上下文

运行 Notion 对话式 Agent

  1. 打开 SkillFlaw 并创建一个新 flow。

  2. 将上述组件添加到你的 flow 画布中,或下载 Conversation Agent Flow 并将该 JSON 文件导入 SkillFlaw。

  3. 按照 flow 图所示连接这些组件。

  4. 在相应组件中输入 Notion 和 OpenAI API keys。

  5. 要启动 flow,请点击 SkillFlaw 中的 "Play" 按钮。

  6. 在聊天界面中输入一个与 Notion 相关的请求或问题。例如:

    • "Create a new page in my task database"
    • "Search for pages about project management"
    • "List all users in my Notion workspace"
  7. Agent 会处理你的请求,使用合适的 Notion tools,并返回响应。

  8. 根据需要继续对话,提出后续问题或发出新的命令。

    示例对话

    _46
    User: List all the users in my Notion workspace.
    _46
    _46
    Agent: Certainly! I'll use the Notion User List tool to retrieve that information for you. One moment please.
    _46
    _46
    [Agent uses the Notion User List tool]
    _46
    _46
    Here's a list of users in your Notion workspace:
    _46
    _46
    1. John Doe (john@example.com)
    _46
    2. Jane Smith (jane@example.com)
    _46
    3. Alex Johnson (alex@example.com)
    _46
    _46
    Is there anything specific you'd like to know about these users or any other Notion-related task I can help you with?
    _46
    _46
    User: Create a new page in my Projects database with the title "Website Redesign".
    _46
    _46
    Agent: Certainly! I'd be happy to create a new page in your Projects database with the title "Website Redesign". I'll use the Notion Page Creator tool to do this. First, let me check the properties of your Projects database to ensure we include all necessary information.
    _46
    _46
    [Agent uses the Notion Database Properties tool]
    _46
    _46
    I've retrieved the properties for your Projects database. Now, I'll create the new page with the title "Website Redesign". One moment please.
    _46
    _46
    [Agent uses the Notion Page Creator tool]
    _46
    _46
    Great news! I've successfully created a new page in your Projects database with the title "Website Redesign". Here are the details:
    _46
    _46
    - Title: Website Redesign
    _46
    - Page ID: [page_id_here]
    _46
    - URL: [page_url_here]
    _46
    _46
    Is there any additional information you'd like me to add to this new project page, such as a description, due date, or assigned team members?
    _46
    _46
    User: Yes, please add a description: "Redesign company website to improve user experience and modernize the look."
    _46
    _46
    Agent: Certainly! I'd be happy to add that description to the "Website Redesign" project page. I'll use the Add Content to Page tool to update the page with this information.
    _46
    _46
    [Agent uses the Add Content to Page tool]
    _46
    _46
    I've successfully added the description to your "Website Redesign" project page. Here's a summary of what I've done:
    _46
    _46
    1. Located the "Website Redesign" page using the page ID from our previous interaction.
    _46
    2. Added the following content to the page:
    _46
    _46
    Description: Redesign company website to improve user experience and modernize the look.
    _46
    _46
    The description has been added as a new text block on the page. Is there anything else you'd like me to add or modify on this project page?

  9. 可选:可以根据团队的具体需求对该 flow 进行自定义。 例如:

    • 调整 system prompt,以改变 agent 的行为或上下文。
    • 根据你的具体需求添加或移除 Notion tools。
    • 修改 OpenAI 模型参数(例如 temperature),以调整 agent 的响应风格。

故障排查

如果你遇到问题:

  1. 确认所有 API keys 都已正确设置,并具有所需权限。
  2. 检查你的 Notion integration 是否有权访问相关页面和 databases。
  3. 确认所有组件都已在 flow 中正确连接。
  4. 查看 SkillFlaw 日志中的错误信息。

有关更高级的使用方式和集成选项,请参阅 Notion API documentation 和 SkillFlaw 文档。