GPT 操作库:Confluence
简介
本页面为开发者提供了一个针对特定应用程序构建 GPT 操作的说明和指南。在继续之前,请务必先熟悉以下信息:
此特定的 GPT 操作提供了有关如何连接到 Confluence(Atlassian 的协作和文档平台)的概述。此操作会接收用户的问题,扫描相关的 Confluence 空间和页面以收集必要信息,然后制定一个回答用户问题的响应。本指南不直接处理从 ChatGPT 更新 Confluence 中的内容,但通过额外的操作和范围,这在技术上是可行的。
价值 + 示例业务用例
价值
用户现在可以利用 ChatGPT 的自然语言能力直接连接到 Confluence,从而实现与组织知识库的无缝交互。
示例用例
- 知识工作者:轻松从 Confluence 页面和空间检索信息,以回答问题或收集报告和演示文稿的详细信息。
- 项目经理:无需手动搜索页面即可快速访问存储在 Confluence 中的项目文档和更新。
- 客户支持团队:通过从 Confluence 知识库提取相关信息,及时准确地回答客户咨询。
- 所有用户:提高对公司范围内的文档、策略和程序的可见性,从而增强协作和知识共享。
应用程序信息
应用程序关键链接
在开始之前,请查看应用程序的这些链接:
- 应用程序网站:https://developer.atlassian.com/console/myapps/
- 应用程序 API 文档:https://developer.atlassian.com/cloud/confluence/rest/v2/intro/#about
应用程序先决条件
在开始之前,请确保在您的应用程序环境中完成以下步骤:
- 确保您拥有在 Atlassian Developer Portal 中创建应用程序的权限
- 确定您希望 GPT 执行的交互(搜索、读取、编辑等)
ChatGPT 步骤
自定义 GPT 说明
创建自定义 GPT 后,请将以下文本复制到“说明”面板中。有疑问吗?请查看 入门示例,了解此步骤的详细信息。
您是“Confluence 专家”,能够搜索我们公司的 Confluence 产品维基以回答产品相关问题。
您必须始终先执行“getAccessibleResources”操作以获取后续操作所需的“cloudid”值。
您的工作是通过从产品维基检索信息来提供准确而详细的响应。您的响应应清晰、简洁,并直接回答用户的问题。您能够执行一个名为“performConfluenceSearch”的操作,该操作允许您使用与用户问题相关的特定术语或短语来搜索我们的 Confluence 产品维基中的内容。
- 当收到有关产品信息的查询时,请使用“performConfluenceSearch”操作从产品维基检索相关内容。根据用户的问题制定搜索查询,使用特定的关键字或短语来查找最相关的信息。
- 收到搜索结果后,请审查内容以确保其与用户的查询匹配。如有必要,请优化您的搜索查询以检索更准确的结果。
- 提供一个综合产品维基信息的响应,清晰地回答用户的问题。您的响应应易于理解并与查询直接相关。
- 如果查询复杂或需要澄清,请向用户提出后续问题以完善您的理解并提高搜索准确性。
- 如果产品维基中没有回答问题所需的信息,请告知用户,并指导他们到何处可以找到答案,例如联系公司中的特定部门或人员。
以下是您可能如何响应查询的示例:
用户:“我们 XYZ 产品的最新功能是什么?”
您:“根据我们产品维基的详细信息,XYZ 产品的最新功能包括 [功能 1]、[功能 2] 和 [功能 3]。这些功能是在最近的更新中添加的,以增强 [特定功能]。有关更详细的信息,您可以参考产品维基页面 [指向特定 Confluence 页面的链接]。”
请记住,您的目标是通过有效利用 Confluence 产品维基,为用户的查询提供有帮助、准确且相关的信息。
OpenAPI 架构
创建自定义 GPT 后,请将以下文本复制到“操作”面板中。有疑问吗?请查看 入门示例,了解此步骤的详细信息。
openapi: 3.1.0
info:
title: Atlassian API
description: This API provides access to Atlassian resources through OAuth token authentication.
version: 1.0.0
servers:
- url: https://api.atlassian.com
description: Main API server
paths:
/oauth/token/accessible-resources:
get:
operationId: getAccessibleResources
summary: Retrieves accessible resources for the authenticated user.
description: This endpoint retrieves a list of resources the authenticated user has access to, using an OAuth token.
security:
- bearerAuth: []
responses:
'200':
description: A JSON array of accessible resources.
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceArray'
/ex/confluence/{cloudid}/wiki/rest/api/search:
get:
operationId: performConfluenceSearch
summary: Performs a search in Confluence based on a query.
description: This endpoint allows searching within Confluence using the CQL (Confluence Query Language).
parameters:
- in: query
name: cql
required: true
description: The Confluence Query Language expression to evaluate.
schema:
type: string
- in: path
name: cloudid
required: true
schema:
type: string
description: The cloudid retrieved from the getAccessibleResources Action
- in: query
name: cqlcontext
description: The context to limit the search, specified as JSON.
schema:
type: string
- in: query
name: expand
description: A comma-separated list of properties to expand on the search result.
schema:
type: string
responses:
'200':
description: A list of search results matching the query.
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResults'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
ResourceArray:
type: array
items:
$ref: '#/components/schemas/Resource'
Resource:
type: object
required:
- id
- name
- type
properties:
id:
type: string
description: The unique identifier for the resource.
name:
type: string
description: The name of the resource.
type:
type: string
description: The type of the resource.
SearchResults:
type: object
properties:
results:
type: array
items:
$ref: '#/components/schemas/SearchResult'
SearchResult:
type: object
properties:
id:
type: string
description: The unique identifier of the content.
title:
type: string
description: The title of the content.
type:
type: string
description: The type of the content (e.g., page, blog post).
space:
type: object
properties:
id:
type: string
description: The space ID where the content is located.
name:
type: string
description: The name of the space.
认证说明
以下是设置此第三方应用程序与 ChatGPT 认证的说明。有疑问吗?请查看 入门示例,了解此步骤的详细信息。
操作前步骤
在 ChatGPT 中设置认证之前,请确保在 Atlassian Developer 门户中完成以下步骤以创建您的 Confluence 应用:
- 选择“创建”下拉菜单
- 选择“OAuth 2.0 集成”
- 命名,同意条款,然后单击“创建”
- 在左侧菜单中选择“分发”,然后单击“编辑”
- 将单选按钮更改为“共享”
- 填写必填字段并保存更改
- 在左侧菜单中选择“权限”
- 添加您想要包含的范围(例如,用户身份 API 和 Confluence API,以便应用了解用户可以访问什么并从 Confluence 获取信息)
- 在左侧菜单中选择“授权”
- 在 OAuth 2.0 的行下单击“添加”
- 输入您 GPT 的回调 URL(注意:您可能需要暂时添加一个占位符,并在创建 GPT 中的操作和 OAuth 后再次访问此 URL,以便获得最终的回调 URL)
- 在左侧菜单中选择“设置”
- 复制您的客户端 ID 和密钥,以便在 GPT 中进行 OAuth 设置
在 ChatGPT 中
在 ChatGPT 中,单击“认证”并选择 “OAuth”。输入以下信息。
- 客户端 ID:使用以上步骤中的客户端 ID
- 客户端密钥:使用以上步骤中的客户端密钥
- 授权 URL:https://auth.atlassian.com/authorize
- 令牌 URL:https://auth.atlassian.com/oauth/token
- 范围:read:confluence-content.all search:confluence
- 令牌:默认 (POST)
操作后步骤
在 ChatGPT 中设置认证后,请按照以下步骤在应用程序中完成操作。
- 复制 GPT 操作中的回调 URL
- 在“授权的重定向 URI”(参见上面的截图)中,添加您的回调 URL
常见问题解答和故障排除
- 回调 URL 错误:如果在 ChatGPT 中遇到回调 URL 错误,请仔细查看上面的截图。您需要将回调 URL 直接添加到您的 Confluence 应用中,操作才能正确认证。
- 架构调用了错误的项目或数据集:如果 ChatGPT 调用了错误的项目或数据集,请考虑更新您的说明,使其更明确地(a)应调用哪个项目/数据集,或(b)要求用户在运行查询前提供这些确切的详细信息。
- 循环操作:您可能没有为您的应用授予完成其预期目的所需的范围/权限。
您希望我们优先处理哪些集成?我们的集成是否存在错误?在我们的 GitHub 上提交 PR 或 issue,我们将进行查看。