Skip to content

获取工作台初始化数据

GET /agent/data/get

客服登录后调用,返回当前客服、进行中会话、客服分组、商户配置、访客属性定义与扩展配置。

请求参数

无业务参数。接口使用当前登录客服的会话身份。

成功响应

以下字段由当前控制器实际返回;会话、设置与扩展项根据当前商户配置动态变化。

json
{
  "code": 0,
  "msg": "ok",
  "data": {
    "chatting": {
      "visitor<访客 UID>": {
        "id": "<访客 UID>",
        "name": "<访客昵称>",
        "type": "visitor",
        "timestamp": 1730000000,
        "pinned_at": 0,
        "unread_count": 0,
        "bot": 0,
        "account_state": "normal",
        "history_only_mine": false,
        "items": []
      }
    },
    "agent": {
      "agent_id": "<当前客服 ID>",
      "nickname": "<客服昵称>",
      "avatar": "<客服头像>",
      "level": "<客服角色>",
      "state": "<客服状态>"
    },
    "agent_groups": [],
    "setting": {},
    "visitor_attribute_config": {},
    "extensions": {
      "nav": [],
      "chat_actions": [],
      "side_iframes": [],
      "flags": {},
      "account_level_options": {}
    }
  }
}
字段类型用途
data.chattingobject进行中会话字典,键为 visitor${uid}
data.chatting.*.idstring访客 UID。
data.chatting.*.unread_countnumber当前客服未读消息数。
data.chatting.*.pinned_atnumber置顶时间戳;未置顶为 0
data.chatting.*.itemsarray最后一条消息摘要数组。
data.agentobject当前登录客服资料。
data.agent_groupsarray当前商户客服分组,包含默认分组。
data.settingobject商户和实时服务配置。
data.visitor_attribute_configobject访客属性预设配置。
data.extensionsobject工作台扩展导航、操作、侧边 iframe 与标志位。