Skip to content

客服消息

使用客服系统可以向用户发送消息以及群发消息,客服的管理等功能。

获取所有客服

OfficialAccountApp.CustomerService.List()

微信官方文档

获取所有在线的客服

OfficialAccountApp.CustomerService.Online()

微信官方文档

添加客服

OfficialAccountApp.CustomerService.Create("[account]", "[nickname]")

微信官方文档

修改客服

OfficialAccountApp.CustomerService.Update("[account]", "[nickname]")

微信官方文档

删除账号

OfficialAccountApp.CustomerService.Delete("[account]")

微信官方文档

设置客服头像

// 本地文件路径
avatarPath := "./resource/cloud.jpg"
OfficialAccountApp.CustomerService.SetAvatar("[account]", avatarPath)

微信官方文档

获取客服与客户聊天记录

OfficialAccountApp.CustomerService.Messages(ctx, &request.RequestMessages{
  StartTime: 987654321,
  EndTime:   987654321,
  MsgID:     1,
  Number:    1000,
})

微信官方文档

主动发送消息给用户

msg := messages.NewText("test message")
OfficialAccountApp.CustomerService.Message(msg).SetTo("[openID]").Send()

微信官方文档

指定客服发送消息

msg := messages.NewText("test message")
OfficialAccountApp.CustomerService.Message(msg).From("[account]").SetTo("[openID]").Send()

微信官方文档

邀请微信用户加入客服

OfficialAccountApp.CustomerService.Invite("[account]", "[wechatID]")

微信官方文档

创建会话

OfficialAccountApp.CustomerServiceSession.Create("[account]", "[openID]")

微信官方文档

关闭会话

OfficialAccountApp.CustomerServiceSession.Close("[account]", "[openID]")

微信官方文档

获取客户会话状态

OfficialAccountApp.CustomerServiceSession.Get("[openID]")

微信官方文档

获取客服会话列表

OfficialAccountApp.CustomerServiceSession.List("[account]")

微信官方文档

获取未接入会话列表

OfficialAccountApp.CustomerServiceSession.Waiting()

微信官方文档

使用示例

参考: PowerWechatTutorial

客服消息 has loaded