接口调用说明
通过该接口查询用户会话所处的状态。
请求 URL 示例
https://console.tim.qq.com/v4/desk_http_svc/get_session_state?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
请求参数说明
参数 | 说明 |
v4/desk_http_svc/get_session_state | 请求接口。 |
sdkappid | 创建应用时即时通信 IM 控制台分配的 SDKAppID。 |
identifier | |
usersig | |
random | 请输入随机的32位无符号整数,取值范围0 - 4294967295。 |
contenttype | 请求格式固定值为 json。 |
请求包示例
指定 SessionId 查询(适用于全部用户端集成方式):
{"SessionId": "b0f4ca12-4850-4218-a284-efe679a87066"}
指定用户和客服号的 UserId 查询(仅适用于"SDK 轻量开发"的用户端集成方式):
{"ClientUserId":"user1","CustomerServiceId":"@customer_service_account"}
请求包字段说明
字段 | 类型 | 属性 | 说明 |
SessionId | String | 选填 | 指定要查询的会话 ID。 |
ClientUserId | String | 选填 | 用户的 UserID。 |
CustomerServiceId | String | 选填 | 客服号的 UserID 。 |
应答包体示例
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"SessionId": "a-b-c-d-e","CurrentState": "Agent","AgentId": "test@qq.com"}
应答包字段说明
字段 | 类型 | 说明 |
ErrorCode | Integer | 错误码: 0表示成功。 非0表示失败。 |
ErrorInfo | String | 错误信息。 |
ActionStatus | String | 请求处理的结果。 |
SessionId | String | 会话 ID。 |
CurrentState | String | 会话当前所处状态,可能的取值有: NotInSession:不在会话中。 Chatbot:机器人接待中。 WaitingForAgentAnswering:等待客服确认接待。 Queueing:转人工排队中。 Agent:人工服务中。 |
AgentId | String | 当状态是 WaitingForAgentAnswering 或 Agent 时,该字段表示接待的人工客服账号。其他状态时该字段为空。 |
错误码说明
除非发生网络错误(例如502错误),否则该接口的 HTTP 返回码均为200。真正的错误码,错误信息是通过应答包体中的 ErrorCode、ErrorInfo 来表示的。
本 API 私有错误码如下:
错误码 | 描述 |
141002 | 内部错误,请重试。 |
141004 | 参数非法。 |
141005 | 会话不存在或已结束。 |