客户联系
企业服务人员管理
获取配置了客户联系功能的成员列表
WeComContactApp.ExternalContact.GetFollowUsers(ctx)
客户联系「联系我」管理
配置客户联系「联系我」方式
options := &request.RequestAddContactWay{
Type: 1,
Scene: 1,
Style: 1,
Remark: "渠道客户",
SkipVerify: true,
State: "teststate",
User: []string{"zhangsan", "lisi", "wangwu"},
Party: []int{2, 3},
IsTemp: true,
ExpiresIn: 86400,
ChatExpiresIn: 86400,
UnionID: "oxTWIuGaIt6gTKsQRLau2M0AAAA",
Conclusions: &power.HashMap{
"text": power.HashMap{
"content": "文本消息内容",
},
"image": power.HashMap{
"media_id": "MEDIA_ID",
},
"link": power.HashMap{
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path",
},
"miniprogram": power.HashMap{
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147dfAAA",
"page": "/path/index.html",
},
},
}
WeComContactApp.ExternalContactContactWay.Add(ctx,options)
获取企业已配置的「联系我」方式
WeComContactApp.ExternalContactContactWay.Get(ctx,"[config_id]")
获取企业已配置的「联系我」列表
options := &request.RequestListContactWay{
1622476800,
1625068800,
"CURSOR",
1000,
}
WeComContactApp.ExternalContactContactWay.List(ctx,options)
更新企业已配置的「联系我」方式
configID := c.DefaultQuery("configID", "42b34949e138eb6e027c123cba77fAAA")
options := &request.RequestUpdateContactWay{
ConfigID: configID,
RequestAddContactWay: request.RequestAddContactWay{
Type: 1,
Scene: 1,
Style: 1,
Remark: "渠道客户",
SkipVerify: true,
State: "teststate",
User: []string{"zhangsan", "lisi", "wangwu"},
Party: []int{2, 3},
IsTemp: true,
ExpiresIn: 86400,
ChatExpiresIn: 86400,
UnionID: "oxTWIuGaIt6gTKsQRLau2M0AAAA",
Conclusions: &power.HashMap{
"text": power.HashMap{
"content": "文本消息内容",
},
"image": power.HashMap{
"media_id": "MEDIA_ID",
},
"link": power.HashMap{
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path",
},
"miniprogram": power.HashMap{
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147dfAAA",
"page": "/path/index.html",
},
},
},
}
WeComContactApp.ExternalContactContactWay.Update(ctx,options)
删除企业已配置的「联系我」方式
WeComContactApp.ExternalContactContactWay.Delete(ctx,"[configID]")
结束临时会话
WeComContactApp.ExternalContactContactWay.CloseTempChat(ctx,"[userid]", "[external_userid]")
客户联系「联系我」管理的官方文档是同一页面
客户管理
获取客户列表
企业可通过此接口获取指定成员添加的客户列表。客户是指配置了客户联系功能的成员所添加的外部联系人。没有配置客户联系功能的成员,所添加的外部联系人将不会作为客户返回。
WeComContactApp.ExternalContact.List(ctx,"[userid]")
获取客户详情
企业可通过此接口,根据外部联系人的userid(如何获取?),拉取客户详情。
cursor := "" // 上次请求返回的next_cursor
WeComContactApp.ExternalContact.Get(ctx,"[userid]", cursor)
批量获取客户详情
userIDs := []string{c.DefaultQuery(ctx,"walle", "matrix-x")}
cursor := "" // 上次请求返回的next_cursor
WeComContactApp.ExternalContact.BatchGet(userIDs, cursor, 100)
修改客户备注信息
options := &request.RequestExternalContactRemark{
UserID: "matrix-x",
ExternalUserID: "woAJ2GCAAAd1asdasdjO4wKmE8Aabj9AAA",
Remark: "备注信息",
Description: "描述信息",
RemarkCompany: "腾讯科技",
RemarkMobiles: []string{
"13800000001",
"13800000002",
},
RemarkPicMediaID: "MEDIAID",
}
WeComContactApp.ExternalContact.Remark(ctx,options)
客户联系规则组管理
获取规则组列表
cursor := "" // 上次请求返回的next_cursor
limit := 1000
WeComContactApp.ExternalContactCustomerStrategy.List(ctx,cursor, limit)
获取规则组详情
WeComContactApp.ExternalContactCustomerStrategy.Get(ctx,1) // strategy_id: 规则组id
获取规则组管理范围
// strategy_id: 规则组id
// cursor: 分页游标,可为空
// limit: 每个分页的成员/部门节点数,默认为1000,最大为1000
WeComContactApp.ExternalContactCustomerStrategy.GetRange(ctx,1, cursor, 1000)
创建新的规则组
options := &request2.RequestCustomerStrategyCreate{
ParentID: 0,
StrategyName: "NAME",
AdminList: []string{
"zhangsan",
"lisi",
},
Privilege: request2.RequestCustomerStrategyCreatePrivilege{
ViewCustomerList: true,
ViewCustomerData: true,
ViewRoomList: true,
ContactMe: true,
JoinRoom: true,
ShareCustomer: true,
OperResignCustomer: true,
SendCustomerMsg: true,
EditWelcomeMsg: true,
ViewBehaviorData: true,
ViewRoomData: true,
SendGroupMsg: true,
RoomDeduplication: true,
RapidReply: true,
OnjobCustomerTransfer: true,
EditAntiSpamRule: true,
ExportCustomerList: true,
ExportCustomerData: true,
ExportCustomerGroupList: true,
ManageCustomerTag: true,
},
Range: []request2.RequestCustomerStrategyCreateRange{
{
Type: 1,
UserID: "zhangsan",
},
{
Type: 2,
PartyID: 1,
},
},
}
WeComContactApp.ExternalContactCustomerStrategy.Create(ctx,options)
编辑规则组及其管理范围
options := &request2.RequestCustomerStrategyEdit{
StrategyID: 1,
StrategyName: "NAME",
AdminList: []string{
"zhangsan",
"lisi",
},
Privilege: request2.RequestCustomerStrategyPrivilege{
ViewCustomerList: true,
ViewCustomerData: true,
ViewRoomList: true,
ContactMe: true,
JoinRoom: true,
ShareCustomer: true,
OperResignCustomer: true,
SendCustomerMsg: true,
EditWelcomeMsg: true,
ViewBehaviorData: true,
ViewRoomData: true,
SendGroupMsg: true,
RoomDeduplication: true,
RapidReply: true,
OnjobCustomerTransfer: true,
EditAntiSpamRule: true,
ExportCustomerList: true,
ExportCustomerData: true,
ExportCustomerGroupList: true,
ManageCustomerTag: true,
},
RangeAdd: []request2.RequestCustomerStrategyRange{
{
Type: 1,
UserID: "zhangsan",
},
{
Type: 2,
PartyID: 1,
},
},
RangeDel: []request2.RequestCustomerStrategyRange{
{
Type: 1,
UserID: "lisi",
},
{
Type: 2,
PartyID: 2,
},
},
}
WeComContactApp.ExternalContactCustomerStrategy.Edit(ctx,options)
删除规则组
WeComContactApp.ExternalContactCustomerStrategy.Del(ctx,1) // strategy_id
客户联系规则组的官方文档都在同一页面
客户标签管理
管理企业标签
获取企业标签库
tagIDs := []string{
"etXXXXXXXXXX",
"etYYYYYYYYYY",
}
groupIDs := []string{
"etZZZZZZZZZZZZZ",
"etYYYYYYYYYYYYY",
}
WeComContactApp.ExternalContactTag.GetCorpTagList(tagIDs, groupIDs)
添加企业客户标签
options := &request.RequestTagAddCorpTag{
GroupID: "GROUP_ID",
GroupName: "GROUP_NAME",
Order: 1,
Tag: []request.RequestTagAddCorpTagFieldTag{
{
Name: "TAG_NAME_1",
Order: 1,
},
{
Name: "TAG_NAME_2",
Order: 2,
},
},
}
WeComContactApp.ExternalContactTag.AddCorpTag(options)
编辑企业客户标签
options := &request.RequestTagEditCorpTag{
ID: "TAG_ID",
GroupName: "NEW_TAG_NAME",
Order: 1,
AgentID: 1000014, // 授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数
}
WeComContactApp.ExternalContactTag.EditCorpTag(options)
删除企业客户标签
options := &request.RequestTagDelCorpTag{
TagID: []string{"TAG_ID_1", "TAG_ID_2"},
GroupID: []string{"GROUP_ID_1", "GROUP_ID_2"},
AgentID: 1000014, // 授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数
}
WeComContactApp.ExternalContactTag.DelCorpTag(options)
管理企业规则组下的客户标签
获取指定规则组下的企业客户标签
options := &request.RequestTagGetStrategyTagList{
TagID: []string{
"etXXXXXXXXXX",
"etYYYYYYYYYY"
},
GroupID: []string{
"etZZZZZZZZZZZZZ",
"etYYYYYYYYYYYYY"
},
StrategyID: 1,
}
WeComContactApp.ExternalContactTag.GetStrategyTagList(options)
为指定规则组创建企业客户标签
options := &request.RequestTagAddStrategyTag{
StrategyID: 1,
GroupID: "GROUP_ID",
GroupName: "GROUP_NAME",
Order: 1,
Tag: []request.RequestTagAddStrategyTagFieldTag{
{
Name: "TAG_NAME_1",
Order: 1,
},
{
Name: "TAG_NAME_2",
Order: 2,
},
},
}
WeComContactApp.ExternalContactTag.AddStrategyTag(options)
编辑指定规则组下的企业客户标签
options := &request.RequestTagEditStrategyTag{
ID: "GROUP_ID",
Name: "GROUP_NAME",
Order: 1,
}
WeComContactApp.ExternalContactTag.EditStrategyTag(options)
删除指定规则组下的企业客户标签
options := &request.RequestTagDelStrategyTag{
TagID: []string{
"TAG_ID_1",
"TAG_ID_2",
},
GroupID: []string{
"GROUP_ID_1",
"GROUP_ID_2",
},
}
WeComContactApp.ExternalContactTag.DelStrategyTag(options)
编辑客户企业标签
options := &request.RequestTagMarkTag{
UserID: "",
ExternalUserID: "",
AddTag: []string{
"TAG_ID_1",
"TAG_ID_2",
},
RemoveTag: []string{
"GROUP_ID_3",
"GROUP_ID_4",
},
}
WeComContactApp.ExternalContactTag.MarkTag(options)
在职继承
分配在职成员的客户
options := &request.RequestTransferCustomer{
HandoverUserID: "walle", // 原跟进成员的userid
TakeoverUserID: "matrix-x", // 接替成员的userid
ExternalUserID: []string{"woAJ2GCAAAXtWyujaWJHDDGi0mACAAAA"},
TransferSuccessMsg: "您好,您的服务已升级,后续将由我的同事李四@腾讯接替我的工作,继续为您服务。",
}
WeComContactApp.ExternalContactTransfer.TransferCustomer(options)
查询客户接替状态
options := &request.RequestTransferResult{
HandoverUserID: "walle",
TakeoverUserID: "matrix-x",
Cursor: "",
}
WeComContactApp.ExternalContactTransfer.TransferResult(options)
离职继承
获取待分配的离职成员列表
pageID := 1
pageSize := 1000
cursor := ""
WeComContactApp.ExternalContactTransfer.GetUnassignedList(pageID, cursor, pageSize)
分配离职成员的客户
options := &request.RequestResignedTransferCustomer{
HandoverUserID: "walle",
TakeoverUserID: "matrix-x",
ExternalUserID: []string{"woAJ2GCAAAXtWyujaWJHDDGi0mACBBBB"},
}
WeComContactApp.ExternalContactTransfer.ResignedTransferCustomer(options)
查询客户接替状态
options := &request.RequestResignedTransferResult{
HandoverUserID: "walle",
TakeoverUserID: "matrix-x",
Cursor: "",
}
WeComContactApp.ExternalContactTransfer.ResignedTransferResult(options)
分配离职成员的客户群
options := &request.RequestGroupChatTransfer{
ChatIDList: []string{
"wrOgQhDgAAcwMTB7YmDkbeBsgT_AAAA",
"wrOgQhDgAAMYQiS5ol9G7gK9JVQUAAAA"
},
NewOwner: "walle",
}
WeComContactApp.ExternalContactTransfer.GroupChatTransfer(options)
客户群管理
获取客户群列表
options := &request.RequestGroupChatList{
StatusFilter: 0,
OwnerFilter: &power.HashMap{
"userid_list": []string{"abel"},
},
Cursor: "r9FqSqsI8fgNbHLHE5QoCP50UIg2cFQbfma3l2QsmwI",
Limit: 10,
}
WeComContactApp.ExternalContactGroupChat.List(options)
获取客户群详情
chatID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
// 是否需要返回群成员的名字group_chat.member_list.name。0-不返回;1-返回。默认不返回
bNeedName := 1
WeComContactApp.ExternalContactGroupChat.Get(chatID, bNeedName)
客户群opengid转换
openID := "oAAAAAAA"
WeComContactApp.ExternalContactGroupChat.OpenGIDToChatID(openID)
客户朋友圈
概述
获取客户朋友圈全部的发表记录
获取企业全部的发表列表
options := &request.RequestGetMomentList{
StartTime: 1605000000,
EndTime: 1605172726,
Creator: "walle",
FilterType: 1,
Cursor: "",
Limit: 10,
}
WeComContactApp.ExternalContactMoment.GetMomentList(options)
获取客户朋友圈企业发表的列表
momentID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
cursor := ""
limit := 100
WeComContactApp.ExternalContactMoment.GetMomentTask(momentID, cursor, limit)
获取客户朋友圈发表时选择的可见范围
momentID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
cursor := ""
limit := 100
userID := "matrix-x"
WeComContactApp.ExternalContactMoment.GetMomentCustomerList(momentID, userID, cursor, limit)
获取客户朋友圈发表后的可见客户列表
momentID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
cursor := ""
limit := 100
userID := "matrix-x"
WeComContactApp.ExternalContactMoment.GetMomentCustomerList(momentID, userID, cursor, limit)
获取客户朋友圈的互动数据
momentID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
userID := "matrix-x"
WeComContactApp.ExternalContactMoment.GetMomentComments(momentID, userID)
客户朋友圈规则组管理
获取规则组列表
cursor := ""
limit := 100
WeComContactApp.ExternalContactMomentStrategy.List(cursor, limit)
获取规则组详情
strategyID := 0
WeComContactApp.ExternalContactMomentStrategy.Get(strategyID)
获取规则组管理范围
strategyID := 0
cursor := ""
limit := 100
WeComContactApp.ExternalContactMomentStrategy.GetRange(strategyID, cursor, limit)
创建新的规则组
options := &request2.RequestMomentStrategyCreate{
ParentID: 0,
StrategyName: "NAME",
AdminList: []string{
"zhangsan",
"lisi",
},
Privilege: &power.HashMap{
"send_moment": true,
"view_moment_list": true,
"manage_moment_cover_and_sign": true,
},
Range: []*power.HashMap{
&power.HashMap{
"type": 1,
"userid": "zhangsan",
},
&power.HashMap{
"type": 2,
"partyid": 1,
},
},
}
WeComContactApp.ExternalContactMomentStrategy.Create(options)
编辑规则组及其管理范围
options := &request2.RequestMomentStrategyEdit{
StrategyID: 1,
StrategyName: "NAME",
AdminList: []string{
"zhangsan",
"lisi",
},
Privilege: &power.HashMap{
"send_moment": true,
"view_moment_list": true,
"manage_moment_cover_and_sign": true,
},
RangeAdd: []*power.HashMap{
&power.HashMap{
"type": 1,
"userid": "zhangsan",
},
&power.HashMap{
"type": 2,
"partyid": 1,
},
},
RangeDel: []*power.HashMap{
&power.HashMap{
"type": 1,
"userid": "lisi",
},
&power.HashMap{
"type": 2,
"partyid": 2,
},
},
}
WeComContactApp.ExternalContactMomentStrategy.Edit(options)
删除规则组
strategyID := 0
WeComContactApp.ExternalContactMomentStrategy.Del(strategyID)
消息推送
创建企业群发
options := &request.RequestSendWelcomeMsg{
WelcomeCode: c.DefaultQuery("welcomeCode", "CALLBACK_CODE"),
Text: &request.TextOfMessage{
"文本消息内容",
},
Attachments: []*power.HashMap{
&power.HashMap{
"msgtype": "image",
"image": power.HashMap{
"media_id": "MEDIA_ID",
"pic_url": "http://p.qpic.cn/pic_wework/3474110808/7a6344sdadfwehe42060/0",
},
}, &power.HashMap{
"msgtype": "link",
"link": power.HashMap{
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path",
},
}, &power.HashMap{
"msgtype": "miniprogram",
"miniprogram": power.HashMap{
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147dfAAA",
"page": "/path/index.html",
},
}, &power.HashMap{
"msgtype": "video",
"video": power.HashMap{
"media_id": "MEDIA_ID",
},
}, &power.HashMap{
"msgtype": "file",
"file":
power.HashMap{
"media_id": "MEDIA_ID",
},
},
},
}
WeComContactApp.ExternalContactMessageTemplate.SendWelcomeMsg(options)
获取企业的全部群发记录
获取群发记录列表
options := &request.RequestGetGroupMsgListV2{
ChatType: "single",
StartTime: 1605171726,
EndTime: 1605172726,
Creator: "matrix-x",
FilterType: 1,
Limit: 50,
Cursor: "CURSOR",
}
WeComContactApp.ExternalContactMessageTemplate.GetGroupMsgListV2(options)
获取群发成员发送任务列表
msgID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
limit := 1000
cursor := ""
WeComContactApp.ExternalContactMessageTemplate.GetGroupMsgTask(msgID, limit, cursor)
获取企业群发成员执行结果
msgID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
userID := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
limit := 1000
cursor := "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA"
WeComContactApp.ExternalContactMessageTemplate.GetGroupMsgSendResult(msgID, userID, limit, cursor)
发送新客户欢迎语
options := &request.RequestSendWelcomeMsg{
WelcomeCode: c.DefaultQuery("welcomeCode", "CALLBACK_CODE"),
Text: &request.TextOfMessage{
"文本消息内容",
},
Attachments: []*power.HashMap{
&power.HashMap{
"msgtype": "image",
"image": power.HashMap{
"media_id": "MEDIA_ID",
"pic_url": "http://p.qpic.cn/pic_wework/3474110808/7a6344sdadfwehe42060/0",
},
}, &power.HashMap{
"msgtype": "link",
"link": power.HashMap{
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path",
},
}, &power.HashMap{
"msgtype": "miniprogram",
"miniprogram": power.HashMap{
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147dfAAA",
"page": "/path/index.html",
},
}, &power.HashMap{
"msgtype": "video",
"video": power.HashMap{
"media_id": "MEDIA_ID",
},
}, &power.HashMap{
"msgtype": "file",
"file":
power.HashMap{
"media_id": "MEDIA_ID",
},
},
},
}
WeComContactApp.ExternalContactMessageTemplate.SendWelcomeMsg(options)
入群欢迎语素材管理
添加入群欢迎语素材
options := &request2.RequestGroupWelcomeTemplateAdd{
Text: &request.TextOfMessage{
"亲爱的%NICKNAME%用户,你好",
},
Image: &request.Image{
"MEDIA_ID",
"http://p.qpic.cn/pic_wework/3474110808/7a6344sdadfwehe42060/0",
},
Link: &request.Link{
"消息标题",
"https://example.pic.com/path",
"消息描述",
"https://example.link.com/path",
},
MiniProgram: &request.MiniProgram{
"消息标题",
"MEDIA_ID",
"wx8bd80126147dfAAA",
"/path/index",
},
File: &request.File{
"1Yv-zXfHjSjU-7LH-GwtYqDGS-zz6w22KmWAT5COgP7o",
},
Video: &request.Video{
"MEDIA_ID",
},
AgentID: 1000014,
Notify: 1,
}
WeComContactApp.ExternalContactGroupWelcomeTemplate.AddGroupWelcomeTemplate(options)
编辑入群欢迎语素材
options := &request2.RequestGroupWelcomeTemplateEdit{
TemplateID: c.DefaultQuery("templateID", "TEMPLATEID"),
Text: &request.TextOfMessage{
"亲爱的%NICKNAME%用户,你好",
},
Image: &request.Image{
"MEDIA_ID",
"http://p.qpic.cn/pic_wework/3474110808/7a6344sdadfwehe42060/0",
},
Link: &request.Link{
"消息标题",
"https://example.pic.com/path",
"消息描述",
"https://example.link.com/path",
},
MiniProgram: &request.MiniProgram{
"消息标题",
"MEDIA_ID",
"wx8bd80126147dfAAA",
"/path/index",
},
File: &request.File{
"1Yv-zXfHjSjU-7LH-GwtYqDGS-zz6w22KmWAT5COgP7o",
},
Video: &request.Video{
"MEDIA_ID",
},
AgentID: 1000014,
Notify: 1,
}
WeComContactApp.ExternalContactGroupWelcomeTemplate.EditGroupWelcomeTemplate(options)
获取入群欢迎语素材
templateID := "TEMPLATEID"
WeComContactApp.ExternalContactGroupWelcomeTemplate.GetGroupWelcomeTemplate(templateID)
删除入群欢迎语素材
templateID := "TEMPLATEID"
agentID, _ := 100001
services.WeComContactApp.ExternalContactGroupWelcomeTemplate.DelGroupWelcomeTemplate(templateID, int64(agentID))
统计管理
获取「联系客户统计」数据
获取「群聊数据统计」数据
变更回调
概述
事件格式
使用示例
当前内容版权归 ArtisanCloud 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ArtisanCloud .