QQ::weixin::work::kf::knowledge
通过分组管理接口,可操作企业管理后台-微信客服-机器人-知识库的分组数据。
相关的约束条件跟管理后台一致:
分组名不能重复 全部分组数上限为100
调用的应用需要满足如下的权限
应用类型 权限要求 自建应用 配置到「 微信客服- 可调用接口的应用」中 第三方应用 暂不支持 代开发自建应用 暂不支持 注: 从2023年12月1日0点起,不再支持通过系统应用secret调用接口,存量企业暂不受影响 查看详情
添加分组
https://developer.work.weixin.qq.com/document/path/95971#添加分组
可通过此接口创建新的知识库分组。
{ "name": "分组名" }
参数 必须 类型 说明 access_token 是 调用接口凭证 name stirng 是 分组名。不超过12个字
{ "errcode": 0, "errmsg": "ok", "group_id" "GROUP_ID" }
参数 类型 说明 errcode int 返回码 errmsg string 错误码描述 group_id string 分组ID
删除分组
https://developer.work.weixin.qq.com/document/path/95971#删除分组
可通过此接口删除已有的知识库分组,但不能删除系统创建的默认分组。
{ "group_id": "GROUP_ID" }
参数 必须 类型 说明 access_token 是 调用接口凭证 group_id string 是 分组ID
{ "errcode": 0, "errmsg": "ok" }
参数 类型 说明 errcode int 返回码 errmsg string 错误码描述
修改分组
https://developer.work.weixin.qq.com/document/path/95971#修改分组
可通过此接口修改已有的知识库分组,但不能修改系统创建的默认分组。
{ "group_id": "GROUP_ID", "name": "分组名" }
参数 必须 类型 说明 access_token 是 调用接口凭证 group_id string 是 分组ID name stirng 是 分组名。不超过12个字
获取分组列表
https://developer.work.weixin.qq.com/document/path/95971#获取分组列表
可通过此接口分页获取所有的知识库分组。
{ "cursor": "CURSOR", "limit": 100, "group_id": "GROUP_ID" }
参数 必须 类型 说明 access_token 是 调用接口凭证 cursor string 否 上一次调用时返回的next_cursor,第一次拉取可以不填 limit uint32 否 每次拉取的数据量,默认值500,最大值为1000 group_id string 否 分组ID。可指定拉取特定的分组
{ "errcode": 0, "errmsg": "ok", "next_cursor": "NEXT_CURSOR", "has_more":1, "group_list": [ { "group_id": "GROUP_ID", "name": "NAME", "is_default": 1 }, { "group_id": "GROUP_ID", "name": "NAME", "is_default": 0 } ] }
参数 类型 说明 errcode int 返回码 errmsg string 错误码描述 next_cursor string 分页游标,再下次请求时填写以获取之后分页的记录 has_more uint32 是否还有更多数据。0-没有 1-有 group_list obj[] 分组列表 group_list[].group_id string 分组ID group_list[].name string 分组名 group_list[].is_default uint32 是否为默认分组。0-否 1-是。默认分组为系统自动创建,不可修改/删除
通过问答管理接口,可操作企业管理后台-微信客服-机器人-知识库的问答数据。
不同分组的问题不能重复 单个分组的问答数上限为200
添加问答
https://developer.work.weixin.qq.com/document/path/95972#添加问答
可通过此接口创建新的知识库问答。
{ "group_id": "GROUP_ID", "question": { "text": { "content": "主问题" } }, "similar_questions": { "items": [ { "text": { "content": "相似问题1" } }, { "text": { "content": "相似问题2" } } ] }, "answers": [ { "text": { "content": "问题的回复" }, "attachments": [ { "msgtype": "image", "image": { "media_id": "MEDIA_ID" } } ] } ] }
参数 必须 类型 说明 access_token 是 调用接口凭证 group_id string 是 分组ID question obj 是 主问题 question.text obj 是 主问题文本 question.text.content string 是 主问题文本内容。不超过200个字 similar_questions obj 否 相似问题 similar_questions.items obj[] 否 相似问题列表。最多支持100个 similar_questions.items[].text obj 是 相似问题文本 similar_questions.items[].text.content string 是 相似问题文本内容。不超过200个字 answers obj[] 是 回答列表。目前仅支持1个 answers[].text obj 是 回答文本 answers[].text.content string 是 回答文本内容。不超过500个字 answers[].attachments obj[] 否 回答附件列表。最多支持4个 answers[].attachments[].* obj 是 回答附件。具体见附录-问答附件类型
{ "errcode": 0, "errmsg": "ok", "intent_id": "INTENT_ID" }
参数 类型 说明 errcode int 返回码 errmsg string 错误码描述 intent_id string 问答ID
删除问答
https://developer.work.weixin.qq.com/document/path/95972#删除问答
可通过此接口删除已有的知识库问答。
{ "intent_id": "INTENT_ID" }
参数 必须 类型 说明 access_token 是 调用接口凭证 intent_id string 是 问答ID
修改问答
https://developer.work.weixin.qq.com/document/path/95972#修改问答
可通过此接口修改已有的知识库问答。 question/similar_questions/answers这三部分可以按需更新,但更新的每一部分是覆盖写,需要传完整的字段。
{ "intent_id": "INTENT_ID", "question": { "text": { "content": "主问题" } }, "similar_questions": { "items": [ { "text": { "content": "相似问题1" } }, { "text": { "content": "相似问题2" } } ] }, "answers": [ { "text": { "content": "问题的回复" }, "attachments": [ { "msgtype": "image", "image": { "media_id": "MEDIA_ID" } } ] } ] }
参数 必须 类型 说明 access_token 是 调用接口凭证 intent_id string 是 问答ID question obj 否 主问题 question.text obj 否 主问题文本 question.text.content string 是 主问题文本内容 similar_questions obj 否 相似问题 similar_questions.items obj[] 否 相似问题列表。最多支持100个 similar_questions.items[].text obj 是 相似问题文本 similar_questions.items[].text.content string 是 相似问题文本内容 answers obj[] 否 回答列表。目前仅支持1个 answers[].text obj 是 回答文本 answers[].text.content string 是 回答文本内容 answers[].attachments obj[] 否 回答附件列表。最多支持4个 answers[].attachments[].* obj 是 回答附件。具体见附录-问答附件类型
获取问答列表
https://developer.work.weixin.qq.com/document/path/95972#获取问答列表
可通过此接口分页获取的知识库问答详情列表。
{ "cursor": "CURSOR", "limit": 100, "group_id": "GROUP_ID", "intent_id": "INTENT_ID" }
参数 必须 类型 说明 access_token 是 调用接口凭证 cursor string 否 上一次调用时返回的next_cursor,第一次拉取可以不填 limit uint32 否 每次拉取的数据量,默认值500,最大值为1000 group_id string 否 分组ID。可指定拉取特定分组下的问答 intent_id string 否 问答ID。可指定拉取特定的问答
{ "errcode": 0, "errmsg": "ok", "next_cursor": "NEXT_CURSOR", "has_more": 1, "intent_list": [ { "group_id": "GROUP_ID", "intent_id": "INTENT_ID", "question": { "text": { "content": "主问题" }, "similar_questions": { "items": [ { "text": { "content": "相似问题1" } }, { "text": { "content": "相似问题2" } } ] }, "answers": [ { "text": { "content": "问题的回复" }, "attachments": [ { "msgtype": "image", "image": { "name": "图片(仅返回名字).jpg" } } ] } ] } } ] }
参数 类型 说明 errcode int 返回码 errmsg string 错误码描述 next_cursor string 分页游标,再下次请求时填写以获取之后分页的记录 has_more uint32 是否还有更多数据。0-没有 1-有 intent_list obj[] 问答摘要列表 intent_list[].group_id string 分组ID intent_list[].intent_id string 问答ID intent_list[].question obj 主问题 intent_list[].question.text obj 主问题文本 intent_list[].question.text.content string 主问题文本内容 intent_list[].similar_questions obj 相似问题 intent_list[].similar_questions.items obj[] 相似问题列表。最多支持100个 intent_list[].similar_questions.items[].text obj 相似问题文本 intent_list[].similar_questions.items[].text.content string 相似问题文本内容 intent_list[].answers obj[] 回答列表。目前仅支持1个 intent_list[].answers[].text obj 回答文本 intent_list[].answers[].text.content string 回答文本内容 intent_list[].answers[].attachments obj[] 回答附件列表。最多支持4个 intent_list[].answers[].attachments[].* obj 回答附件。具体见附录-问答附件类型
To install QQ::weixin::work, copy and paste the appropriate command in to your terminal.
cpanm
cpanm QQ::weixin::work
CPAN shell
perl -MCPAN -e shell install QQ::weixin::work
For more information on module installation, please visit the detailed CPAN module installation guide.