# 配置信息
例如:
APPID: xxxxxxxxxxxxxxx
TOKEN: xxxxxxxxxxxxxxx
EncodingAESKey: xxxxxxxxxxxxxxx
# 接口信息
对文本进行实时聚合。本文档提供聚簇内所有文本信息拉取接口。
# 文本实时聚合-聚簇详情拉取接口(只签名不加密):
https://chatbot.weixin.qq.com/openapi/nlp/topk_cluster/TOKEN
接口类型:
POST请求
# 参数说明:
字段 | 类型 | 默认值 | 描述 |
---|---|---|---|
query | string | 使用JWT签名后的数据 |
query签名说明:
字段 | 类型 | 默认值 | 描述 |
---|---|---|---|
uid | string | 自动生成的随机标识 | 用户标识的唯一ID,比如:openid |
data | Object | {"text": "聚簇的中心句式", "bucket": "xewrwex123"} |
使用JSON Web Token的 HS256
算法对参数进行encode, 放入到query参数中
比如参数为
{
uid: "xjlsj33lasfaf", //能标识用户的唯一用户id,可以是openid
data: {
text: "聚簇的中心句式",
bucket: "xewrwex123", //房间ID,获取该房间的评论数、问题数、聚类数、销售线索数等信息。
}
}
使用 jwt 和 EncodingAESKey
对数据对象进行encode得到加密字符串
const signedData = jwths256.encode(EncodingAESKey, {
uid: "xjlsj33lasfaf", //能标识用户的唯一用户id,可以是openid
data: {
text: "聚簇的中心句式",
bucket: "xewrwex123", //房间ID,获取该房间的评论数、问题数、聚类数、销售线索数等信息。
}
}
)
# 调用开放平台语义接口
curl -XPOST -d "query=signedData" https://chatbot.weixin.qq.com/openapi/nlp/topk_cluster/TOKEN
Tips: 在 jsonwebtoken.io 网站上可以参考如下步骤手动生成signedData
# 返回结果
{
"cluster": [
{
"text": "明天有没有活动呀?",
"score": 1,
"sale_clues": "销售线索-优惠",
"is_question": "YES",
"count": 4,
"user_specific": [
{
"uid": "user1",
"responded_by_bot": false,
"responded_by_streamer": false
},
{
"uid": "user2",
"responded_by_bot": true,
"responded_by_streamer": true
},
{
"uid": "user3",
"responded_by_bot": false,
"responded_by_streamer": true
}
],
"count_not_responded": 1,
"count_user": 3,
"count_user_not_responded": 1
},
{
"text": "有没有折扣呀?",
"score": 1,
"sale_clues": "销售线索-优惠",
"is_question": "YES",
"count": 1,
"user_specific": [
{
"uid": "user1",
"responded_by_bot": false,
"responded_by_streamer": false
}
],
"count_not_responded": 1,
"count_user": 1,
"count_user_not_responded": 1
}
]
}