侧边栏

文档首页


CRM扩展

数据接口

呼叫能力

Android IM SDK手册(暂停使用)

iOS IM SDK手册(暂停使用)

Android SIP SDK手册

iOS SIP SDK手册

客户端标准版快速集成

帮我吧远程SDK版本

网页在线客服集成

微信接入

帮我吧文档:数据接口:服务记录:在线聊天

在线聊天会话记录

此接口用来获取从微信、网页、机器人来的历史会话记录。

会话JSON格式

名称 类型 注释
r_id int 会话id
type tinyint 会话来源:1-客户端,2-网页,3-微信,4-机器人,5-客服,8-第三方
support_id int 处理客服id
support_name varchar 处理客服名字
uname varchar 用户标识
start_time datetime 会话开始时间,格式为:2017-08-20
end_time datetime 会话结束时间,格式为:2017-08-20
client_ip varchar 用户IP
ip_info varchar 用户IP详情
evaluate tinyint 评价:0-未评价,1-满意,2-一般,3-不满意
evaluate_time datetime 评价时间,格式为:2017-08-20
evaluate_remark text 评价内容
end_type tinyint 服务结束类型,取值为:1-客户主动结束服务,2-客服主动结束服务
servicer_msg_count int 客服发出的消息总数
client_msg_count int 客户发出的消息总数
first_response int 客服第一次响应时间距离服务开始时间的秒数
contents varchar 聊天记录的资源url
response_speed int 响应时常(s)
chat_clue varchar 线索

会话JSON示例

{
    "r_id": "122",
    "type": "2",
    "support_id": "2321",
    "support_name": "张三",
    "uname": "u3_o2_slufdbltr0cylrmrcokice",
    "start_time": "2017-8-23 12:23:12",
    "end_time": "2017-8-23 12:23:12",
    "client_ip": "114.248.128.190",
    "ip_info": "归属地为北京市",
    "evaluate": "1",
    "evaluate_time": "2017-8-23 12:44:12",
    "evaluate_remark": "服务态度很好",
    "end_type": "1",
    "servicer_msg_count": "23",
    "client_msg_count": "25",
    "response_speed": "0",
    "chat_clue": "",
    "first_response": "34",
    "contents": "https://www.bangwo8.com/api/v1/imchat/chatrecords/122.json"
}

消息JSON格式

名称 类型 注释
spokesman varchar 发言人的名字。发言人是客服时,返回客服姓名,发言人是用户时,返回用户标识
spokesman_identity tinyint 发言人的身份:1-客服,2-用户,3-机器人
msg text 聊天内容
create_time datetime 消息发送时间

消息JSON示例

 {
     "spokesman": "u2_6_412696422494",
     "spokesman_identity": "2",
     "msg": "kj",
     "create_time": "2018-10-24 15:14:12"
}

会话列表

GET /api/v1/imchat/histories.json

说明:返回所有的会话记录,默认按编号升序排列。

调用者权限

管理员

调用参数

名称 必填 类型 注释
uname int 按用户标识筛选
servicestart_start datetime 按服务开始时间筛选:开始时间
servicestart_end datetime 按服务开始时间筛选:结束时间
serviceend_start datetime 按服务结束时间筛选:开始时间
serviceend_end datetime 按服务结束时间筛选:结束时间
page int 分页获取,默认为1
per_page int 每页大小,默认为100

说明:默认按编码升序返回。时间参数(servicestart_start、servicestart_end、serviceend_start、updated_end)格式为“2012-01-01”,结束时间是包含当前时间的,例如结束时间为2017-08-29,则返回的记录包含2017-08-29当天的。

调用示例

curl https://www.bangwo8.com/api/v1/imchat/histories.json -v -u {account}:{password}

返回值示例

{
	"chats": [
		{
			"r_id": 111,
			"type": "1",
			...
		},
		{
			"r_id": 112,
			"type": "2",
			...
		}
                ...
	],
        "count": 42,
        "next_page": "https://www.bangwo8.com/api/v1/imchat/histories.json?per_page=40&page=2",
        "previous_page": null
}

查看指定客服的会话列表

GET /api/v1/imchat/histories/{id}.json

说明:返回当前客服的所有会话记录,默认按编号升序排列。

调用者权限

管理员

调用参数

名称 必填 类型 注释
uname int 按用户标识筛选
servicestart_start datetime 按服务开始时间筛选:开始时间
servicestart_end datetime 按服务开始时间筛选:结束时间,与servicestart_start成对出现
serviceend_start datetime 按服务结束时间筛选:开始时间
serviceend_end datetime 按服务结束时间筛选:结束时间,与serviceend_start成对出现
page int 分页获取,默认为1
per_page int 每页大小,默认为100

说明:默认按编码升序返回。时间参数(servicestart_start、servicestart_end、serviceend_start、serviceend_end)格式为“2012-01-01”,结束时间是包含当前时间的,例如结束时间为2017-08-29,则返回的记录包含2017-08-29当天的。

调用示例

curl https://www.bangwo8.com/api/v1/imchat/histories/12323.json -v -u {account}:{password}

返回值示例

{
	"chats": [
		{
			"r_id": 111,
			"type": "1",
			...
		},
		{
			"r_id": 112,
			"type": "2",
			...
		}
                ...
	],
        "count": 42,
        "next_page": "https://www.bangwo8.com/api/v1/imchat/histories/12323.json?per_page=40&page=2",
        "previous_page": null
}

查看指定会话的聊天记录

GET /api/v1/imchat/chatrecords/{id}.json

调用者权限

所有客服

调用参数

名称 必填 类型 注释
time_start datetime 按聊天内容发送日期筛选:开始时间,格式为:2017-8-27
time_end datetime 按聊天内容发送日期筛选:结束时间,格式为:2017-8-27,与time_start成对出现
page int 分页获取,默认为1
per_page int 每页大小,默认为100

调用示例

curl https://www.bangwo8.com/api/v1/imchat/chatrecords/221.json -v -u {account}:{password}

返回值示例

Status: 200 OK
{
	"im_chatrecords":{
		"r_id":"221",
		"contents":[
			{
				"spokesman":213,
				"spokesman_identity":1,
				"msg":"这里是具体的聊天内容",
				"create_time":"2017-8-23 13:12:23"
			},
			{
				"spokesman":234,
				"spokesman_identity":1,
				"msg":"这里是具体的聊天内容",
				"create_time":"2017-8-23 13:12:23"
			}
                        ...
		]
	},
        "count":42,
        "next_page":"https://www.bangwo8.com/api/v1/imchat/chatrecords/221.json?per_page=40&page=2",
        "previous_page":null
}

查看指定会话的服务总结

请求参数

名称 必填 类型 注释
r_Id int会话id
servicesummary_typeint 1-im 2-呼叫中心 3-远程协助 获取在线聊天的会话服务总结servicesummary_type=1

请求地址

GET  /api/v1/servicesummary/{r_Id}.json 

说明:接口返回值中的级联类型的字段,当前接口默认返回的是选项ID,以下接口可返回选项内容,而非选项ID

GET  /api/v1/servicesummary_v2/{r_Id}.json 

调用者权限

所有客服

调用示例

curl https://www.bangwo8.com/api/v1/servicesummary/221.json?servicesummary_type=1 -v -u {account}:{password}

返回参数

名称 只读 类型 注释
ticketTemplateName String模板名称
custom_fieldsarray 服务总结模板自定义字段

返回值示例

{
    "status":"200" ,
    "message":"Successful",
    "data":{
      "serviceSummary":{
         "ticketTemplateName": "im服务总结模板",
          "custom_fields": [//自定义字段
            {
              "key": "field_1",//自定义字段的唯一标识,可从帮我吧后台查看
              "value": "4334"
            },
            {
              "key": "field_3",//自定义字段的唯一标识,可从帮我吧后台查看
              "value": "1" //复选框
            },
            {
              "key": "field_2",
              "value": "下拉菜单的某一项"
            },
            {
              "key": "field_4",
              "value": "附件的下载地址" //附件多个时,以逗号分隔
            }
          ]
    
        }  
    }
}

没有绑定服务总结模板返回示例

{ 
   "status":"120001" ,
   "message":"No service summary template",
}

未填写服务总结返回示例

{ 
   "status":"120002" ,
   "message":"No service summary information",
}

获取指定客服状态切换时间列表

请求参数

名称 必填 类型 注释
time_start datetime 开始时间,包含当天
time_end datetime 结束时间,包含当天

请求地址

GET   /api/v1/serviceState/{sId}.json

调用者权限

管理员

调用示例

curl  -X GET -v -u {account}:{password} https://www.bangwo8.com/api/v1/serviceState/356789.json?time_start=2020-06-08&time_end=2020-06-08

返回参数

名称 类型 注释
sId int 客服id
currentState string 客服IM当前状态
data array 切换状态时间列表

返回值示例

Status: 200 OK
{
    "serviceState":{
        "sId":356789,
        "currentState":"离线",
        "data":{
            "2020-06-08 09:00:07":"在线",
            "2020-06-08 12:00:10":"离线",
            "2020-06-08 13:30:07":"在线"      
        }
    }
}

页面工具