客服
使用客服系統可以向用戶發送消息以及群發消息,客服的管理等功能。
客服管理
獲取所有客服
$officialAccount->customerService->list();
獲取所有在線的客服
$officialAccount->customerService->online();
添加客服
$officialAccount->customerService->create('foo@test', '客服1');
修改客服
$officialAccount->customerService->update('foo@test', '客服1');
刪除賬號
$officialAccount->customerService->delete('foo@test');
設置客服頭像
// $avatarPath 為本地圖片路徑,非 URL
$officialAccount->customerService->setAvatar('foo@test', $avatarPath);
獲取客服與客戶聊天記錄
$officialAccount->customerService->messages($startTime, $endTime, $msgId = 1, $number = 10000);
使用示例:
<?php
$records = $officialAccount->customerService->messages('2015-06-07', '2015-06-21', 1, 20000);
主動發送消息給用戶
$officialAccount->customerService->send(array $message);
$message 為數組,請參考:消息
使用示例:
暫略。
邀請微信用戶加入客服
以賬號 foo@test
邀請 微信號 為 xxxx
的微信用戶加入客服。
$officialAccount->customerService->invite('foo@test', 'xxxx');
客服會話控制
創建會話
$officialAccount->customerServiceSession->create('test1@test', 'OPENID');
關閉會話
$officialAccount->customerServiceSession->close('test1@test', 'OPENID');
獲取客戶會話狀態
$officialAccount->customerServiceSession->get('OPENID');
獲取客服會話列表
$officialAccount->customerServiceSession->list('test1@test');
獲取未接入會話列表
$officialAccount->customerServiceSession->waiting();