客服消息
使用客服系统可以向用户发送消息以及群发消息,客服的管理等功能。
获取所有客服
go
OfficialAccountApp.CustomerService.List()获取所有在线的客服
go
OfficialAccountApp.CustomerService.Online()添加客服
go
OfficialAccountApp.CustomerService.Create("[account]", "[nickname]")修改客服
go
OfficialAccountApp.CustomerService.Update("[account]", "[nickname]")删除账号
go
OfficialAccountApp.CustomerService.Delete("[account]")设置客服头像
go
// 本地文件路径
avatarPath := "./resource/cloud.jpg"
OfficialAccountApp.CustomerService.SetAvatar("[account]", avatarPath)获取客服与客户聊天记录
go
OfficialAccountApp.CustomerService.Messages(ctx, &request.RequestMessages{
StartTime: 987654321,
EndTime: 987654321,
MsgID: 1,
Number: 1000,
})主动发送消息给用户
go
msg := messages.NewText("test message")
OfficialAccountApp.CustomerService.Message(msg).SetTo("[openID]").Send()指定客服发送消息
go
msg := messages.NewText("test message")
OfficialAccountApp.CustomerService.Message(msg).From("[account]").SetTo("[openID]").Send()邀请微信用户加入客服
go
OfficialAccountApp.CustomerService.Invite("[account]", "[wechatID]")创建会话
go
OfficialAccountApp.CustomerServiceSession.Create("[account]", "[openID]")关闭会话
go
OfficialAccountApp.CustomerServiceSession.Close("[account]", "[openID]")获取客户会话状态
go
OfficialAccountApp.CustomerServiceSession.Get("[openID]")获取客服会话列表
go
OfficialAccountApp.CustomerServiceSession.List("[account]")获取未接入会话列表
go
OfficialAccountApp.CustomerServiceSession.Waiting()