1. 接口描述
接口请求域名:
ccc.tencentcloudapi.com
。获取指定服务记录文本聊天内容,需要先使用查询在线客服记录(DescribeIMCdrs) API 获取服务记录 SessionId。
文本聊天记录只保存了 1 年内的,1 年之前会自动清理。
默认接口请求频率限制:20次/秒。
2. 输入参数
参数名称 | 必选 | 类型 | 描述 |
Action | 是 | String | |
Version | 是 | String | |
Region | 是 | String | |
SdkAppId | 否 | Integer | 应用 ID(必填)
示例值:1400000000 |
CdrId | 否 | String | 服务记录 ID(废弃)
示例值:13503 |
Limit | 否 | Integer | 返回记录条数,最大为100 默认20
示例值:20 |
Offset | 否 | Integer | 返回记录偏移,默认为 0
示例值:0 |
Order | 否 | Integer | 1为从早到晚,2为从晚到早,默认为2
示例值:1 |
SessionId | 否 | String | 服务记录 SessionID(必填)
示例值:d6253538-7c28-477b-998a-919059801899 |
3. 输出参数
参数名称 | 类型 | 描述 |
TotalCount | Integer | 总记录数
示例值:0 |
Messages | 消息列表
注意:此字段可能返回 null,表示取不到有效值。
示例值:[{"Timestamp":1600007226,"From":"John","Messages":[{"Type":"Text","Content":"Hello, how are you?"},{"Type":"Image","Content":"https://example.com/image.jpg"}]},{"Timestamp":1400753150,"From":"Alice","Messages":[{"Type":"Text","Content":"Hi there!"}]}] | |
RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
4. 示例
示例1 查询聊天记录示例
获取指定服务记录的文本消息记录。
输入示例
POST / HTTP/1.1Host: ccc.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: DescribeChatMessages<公共请求参数>{"SdkAppId": 1400000000,"SessionId": "d6253538-7c28-477b-998a-919059801899"}
输出示例
{"Response": {"RequestId": "48edd236-7ef1-45af-9e12-fc376ba355bf","TotalCount": 2,"Messages": [{"Timestamp": 1600007226,"From": "John","Messages": [{"Type": "Text","Content": "Hello, how are you?"},{"Type": "Image","Content": "https://example.com/image.jpg"}]},{"Timestamp": 1400753150,"From": "Alice","Messages": [{"Type": "Text","Content": "Hi there!"}]}]}}
5. 开发者资源
腾讯云 API 平台
API Inspector
SDK
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
命令行工具
6. 错误码
错误码 | 描述 |
InternalError | 内部错误。 |
InternalError.DBError | 内部数据库访问失败。 |
InvalidParameterValue | 参数取值错误。 |
InvalidParameterValue.InstanceNotExist | 实例不存在。 |
InvalidParameterValue.RecordNotExist | 查询记录不存在。 |