Files
htsy-skill/htsy/references/api-friend.md
T

19 KiB
Raw Blame History

客户、联系人与标签

阅读本文件处理客户列表、客户详情、同步、备注、单向客户、黑名单、客户标签、企微官方标签等操作。

客户与联系人

目标 接口 请求字段 常用返回字段
行为日志列表 POST /api/wx/friend/activitylog/list page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)friendId(int64, 可选,客户id ,为空则为整个账号的);type(int32, 可选,根据类型筛选) list(repeated Info,客户信息)page(int64)pageSize(int64)total(int64,总数)last(bool,是否最后一页)
黑名单-列表 POST /api/wx/friend/blacklist/list page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize) list(repeated BlacklistInfo,客户信息)page(int64)pageSize(int64)total(int64,总数)last(bool,是否最后一页)
黑名单-添加 POST /api/wx/friend/blacklist/add friendId(int64, 必填,客户id) id(int64)
黑名单-添加到企微群聊黑名单(通常用这个将客户剔除群聊) POST /api/wx/friend/blacklist/addQw friendWxid(string, 必填,好友wxid)botId(int64, 可选,机器人id)status(int64, 必填,状态 1拉黑 0移出);botWxid(string, 可选,机器人wxid 优先判断botIdbotid和botwxid 2选1) 空对象或无业务数据
黑名单-删除 POST /api/wx/friend/blacklist/del friendId(int64, 必填,客户id)id(int64, 必填,黑名单id) 空对象或无业务数据
黑名单数据包-同步黑名单 POST /api/wx/friend/blacklist/sync packageId(int64, 必填,黑名单包id) 空对象或无业务数据
黑名单数据包-列表 POST /api/wx/friend/blacklist/package/list {} list(repeated PackageInfolist)
黑名单数据包-开关 POST /api/wx/friend/blacklist/package/switch packageId(int64, 必填,包的id)switch(bool, 必填,开关) 空对象或无业务数据
黑名单数据包-客户列表 POST /api/wx/friend/blacklist/package/friendList page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)packageId(int64, 必填,包id)wxid(string, 可选,好友的wxid)nickName(string, 可选,好友的昵称) list(repeated BlacklistInfo,客户信息)page(int64)pageSize(int64)total(int64,总数)last(bool,是否最后一页)
客户列表 POST /api/wx/friend/list page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)name(string, 可选,昵称搜索)botType(int32, 必填,类型 1 个微 2企微);ids(repeated int64, 可选,ids,客户ids)botId(int64, 可选,机器人id)botIds(repeated int64, 可选,机器人ids)corpId(string, 必填,主体id)filters(repeated TargetFilter, 可选,多筛选条件,且的关系);inTagIds(repeated int64, 可选,包含标签ids)notInTagIds(repeated int64, 可选,排除标签ids)inQwTagIds(repeated string, 可选,包含企微标签ids);notInQwTagIds(repeated string, 可选,排除企微标签ids);threePartyService(string, 可选,三方服务过滤部分字段使用);groupRange(repeated int64, 可选,所属群聊)friendType(int32, 可选,客户类型 1 个微 2 企微) list(repeated FriendInfo,客户信息)page(int64)pageSize(int64)total(int64)last(bool)
通过客户wxId获取客户信息 POST /api/wx/friend/list/byWxid wxids(repeated string, 可选) list(repeated FriendInfo,客户信息)
客户详情 POST /api/wx/friend/get id(int64, 必填,客户的id)botType(int32, 必填,个微还是企微)botId(int64, 可选,机器人id)corpId(string, 可选,主体id) id(int64id)nickname(string,昵称)avatar(string,头像)wxid(string,客户的wxid)tagList(repeated api.wx.wxgatewayfriendTag.Tag,标签列表)sex(int32,性别)remark(string,备注)isBlack(bool,是否是黑名单)botFriendInfoList(repeated FriendInfoByBot,和微号相关的信息)groupFriendInfoList(repeated FriendInfoByGroup,和群相关的信息)...
同步客户列表 POST /api/wx/friend/manualSync botIds(repeated int64, 必填,机器人id列表)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
同步内部联系人(仅限企微号) POST /api/wx/friend/inner/manualSync botIds(repeated int64, 必填,机器人id列表)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
内部联系人列表(仅限企微号) POST /api/wx/friend/inner/list page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)botType(int32, 必填,类型 1 个微 2企微);ids(repeated int64, 可选,ids,客户ids)wxids(repeated string, 可选,wxids)corpId(string, 可选,主体id)name(string, 可选,按名称搜索) list(repeated InnerFriendItem,内部联系人信息)page(int64)pageSize(int64)total(int64)last(bool)
内部联系人添加(仅限企微号) POST /api/wx/friend/inner/add id(int64, 必填,id)nickname(string, 必填,昵称)avatar(string, 可选,头像)wxid(string, 必填,客户的wxid)sex(int32, 可选,性别)corpId(string, 可选,主体id) id(int64id)
内部联系人删除(仅限企微号) POST /api/wx/friend/inner/del wxid(string, 必填,id)corpId(string, 必填,corpId) 空对象或无业务数据
内部联系人更新(仅限企微号) POST /api/wx/friend/inner/update id(int64, 必填,id)nickname(string, 必填,昵称)avatar(string, 可选,头像)wxid(string, 必填,客户的wxid)sex(int32, 可选,性别)corpId(string, 可选,主体id) 空对象或无业务数据
同步通信录 POST /api/wx/friend/contacts/sync botIds(repeated int64, 必填,机器人id)botType(int32, 必填,类型 1 个微 2企微) list(repeated SyncContactItem)
客户备注 POST /api/wx/friend/remark/set friendId(int64, 必填,客户id)remark(string, 必填,备注)botType(int32, 必填,个微还是企微)botId(int64, 必填,微号id) 空对象或无业务数据
客户拉黑企微 - 列表 POST /api/wx/friend/single/blacklist/list page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)botType(int32, 必填,类型 1 个微 2企微);botIds(repeated int64, 可选,机器人ids)corpId(string, 可选,主体id)nickname(string, 可选,客户昵称筛选) list(repeated HttpSingleBlackFriendItem,客户信息)page(int64)pageSize(int64)total(int64)last(bool)
客户拉黑企微-删除 POST /api/wx/friend/single/blacklist/del ids(repeated int64, 必填,客户微号的id) 空对象或无业务数据
单向客户列表 POST /api/wx/friend/singleList page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)botType(int32, 必填,类型 1 个微 2企微);botIds(repeated int64, 可选,机器人ids)nickname(string, 可选,客户昵称筛选);corpId(string, 可选,主体id)addTimeStart(int64, 可选,添加时间开始)addTimeEnd(int64, 可选,添加时间结束)timeStart(int64, 可选,流失时间开始)timeEnd(int64, 可选,流失时间结束) list(repeated HttpSingleFriendListItem,客户信息)page(int64)pageSize(int64)total(int64)last(bool)
单向客户同步 POST /api/wx/friend/single/sync botId(int64, 必填,微号id)botType(int32, 必填,微号类型) 空对象或无业务数据
单向客户删除 POST /api/wx/friend/single/del ids(repeated int64, 必填,客户微号的id) 空对象或无业务数据
客户删除 POST /api/wx/friend/deleteFriend ids(repeated int64, 必填,ids)botId(int64, 必填,botId)botType(int32, 必填,微号类型) 空对象或无业务数据
企微删除客户记录 - 列表 POST /api/wx/friend/del/recordList page(int64, 必填,分页page)pageSize(int64, 必填,分页pageSize)botType(int32, 必填,类型 1 个微 2企微);botIds(repeated int64, 可选,机器人ids)corpId(string, 可选,主体id)nickname(string, 可选,客户昵称筛选) list(repeated HttpSingleFriendListItem,客户信息)page(int64)pageSize(int64)total(int64)last(bool)
单向客户删除记录 POST /api/wx/friend/single/delRecord ids(repeated int64, 必填,客户微号的id) 空对象或无业务数据
被动黑名单删除记录 POST /api/wx/friend/single/blacklist/delRecord ids(repeated int64, 必填,客户微号的id) 空对象或无业务数据
获取客户和群成员信息 POST /api/wx/friendAndGroup/info friendAndGroupWxid(repeated string, 必填,客户和群成员的wxid);botType(int32, 必填,微号类型) list(repeated FriendAndGroupInfo)
获取客户的所属群信息 POST /api/wx/friend/info/group ids(repeated int64, 必填,客户的id)botType(int32, 必填,微号类型) list(repeated FriendGroupInfoItem)
获取客户昵称头像信息 POST /api/wx/friend/baseInfo/byWxids botType(int32, 必填,微号类型)wxids(repeated string, 必填,wxids) list(repeated FriendBaseInfo)

客户标签

目标 接口 请求字段 常用返回字段
自动打标-添加 POST /api/wx/friend/tag/autoPlan/add name(string, 必填,名字)botType(int32, 必填,类型 1 个微 2企微);type(string, 必填,打标计划的类型 quick event)filters(repeated TargetFilter, 必填,筛选条件)tagIdList(repeated int64, 必填,标签列表)dynamicTag(string, 必填,动态标签)botIds(repeated int64, 必填,微号ids)qwTagIdList(repeated string, 必填,企微标签ids)corpId(string, 必填,主体) id(int64id)
自动打标-删除 POST /api/wx/friend/tag/autoPlan/delete id(int64, 必填,id) 空对象或无业务数据
自动打标-列表 POST /api/wx/friend/tag/autoPlan/list botType(int32, 必填,类型 1 个微 2企微);page(int64, 可选,分页page)pageSize(int64, 可选,分页pageSize)name(string, 可选,计划名称)status(string, 可选,状态)type(string, 可选,计划类型 事件event 普通 quick) list(repeated HttpAutoTagPlanDetailReply,标签列表)page(int64)pageSize(int64)total(int64)last(bool)
自动打标-详情 POST /api/wx/friend/tag/autoPlan/detail id(int64, 必填,id) name(string,名字)botType(int32,类型 1 个微 2企微)type(string,打标计划的类型 manual)filters(repeated TargetFilter,筛选条件)tagIdList(repeated int64,标签列表)id(int64id)status(string,状态)tagList(repeated api.wx.wxgatewayfriendTag.Tag,标签详情列表)dynamicTag(string,动态标签)botIds(repeated int64,微号ids)...
自动打标-预估人数 POST /api/wx/friend/tag/autoPlan/predictPeople botType(int32, 必填,类型 1 个微 2企微);filters(repeated TargetFilter, 必填,筛选条件)botIds(repeated int64, 可选,机器人id列表)corpId(string, 必填,主体id) num(int64,人数)
自动打标-开关 POST /api/wx/friend/tag/autoPlan/switch id(int64, 必填,id)status(string, 必填,状态:[executing,stop]) 空对象或无业务数据
自动打标-更新 POST /api/wx/friend/tag/autoPlan/update id(int64, 必填,id)name(string, 必填,名字)botType(int32, 必填,类型 1 个微 2企微);type(string, 必填,打标计划的类型 quick event)filters(repeated TargetFilter, 必填,筛选条件)tagIdList(repeated int64, 必填,标签列表)dynamicTag(string, 必填,动态标签)botIds(repeated int64, 必填,botIds)qwTagIdList(repeated string, 必填,企微标签ids)corpId(string, 必填,主体) 空对象或无业务数据
自动打标-记录 POST /api/wx/friend/tag/autoPlan/record botId(int64, 可选,微号id)status(string, 可选,状态)page(int64, 可选,分页page)pageSize(int64, 可选,分页pageSize)pid(int64, 可选,计划id)botType(int32, 必填,类型 1 个微 2企微) list(repeated HttpAutoTagPlanRecordReplyItem,列表)page(int64)pageSize(int64)total(int64)last(bool)
自动打标-统计 POST /api/wx/friend/tag/autoPlan/record/count botId(int64, 可选,微号id)pid(int64, 可选,计划id) list(repeated HttpAutoTagPlanRecordCountItem,列表)
标签-标签列表 POST /api/wx/friend/tag/list botType(int32, 必填,类型 1 个微 2企微);page(int64, 可选,分页page)pageSize(int64, 可选,分页pageSize)name(string, 可选,名字)ids(repeated int64, 可选,ids)sort(int64, 可选,0 默认 1 人数升序 2 人数降序);isLatestNum(bool, 可选,是否展示最新人数) list(repeated TagGroupItem,分组标签列表)page(int64)pageSize(int64)total(int64)last(bool)needLoadTagList(bool,是否需要加载标签列表)
标签-根据标签组单独加载 POST /api/wx/friend/tag/list/byGroup groupId(int64, 必填,标签组id)botType(int32, 必填,类型 1 个微 2企微);sort(int64, 可选,0 默认 1 人数升序 2 人数降序);isLatestNum(bool, 可选,是否展示最新人数) tagList(repeated TagItem,子标签)
标签-标签添加 POST /api/wx/friend/tag/add botType(int32, 必填,类型 1 个微 2企微);name(string, 必填,标签名字) id(int64id)
标签-标签删除 POST /api/wx/friend/tag/del id(int64, 必填,id)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签批量删除 POST /api/wx/friend/tag/batchDel ids(repeated int64, 必填,ids)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签更新 POST /api/wx/friend/tag/update id(int64, 必填,id)name(string, 必填,标签名字)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签排序 POST /api/wx/friend/tag/updatePosition groupId(int64, 可选)tagIds(repeated int64, 可选)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签导入 POST /api/wx/friend/tag/friendImport targetTagId(int64, 必填,导入的目标标签);tagIds(repeated int64, 必填,其他标签)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-客户批量添加标签 POST /api/wx/friend/tag/friendAddTag friendIdList(repeated int64, 必填,客户id列表)tagIdList(repeated int64, 必填,标签id列表)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-客户批量删除标签 POST /api/wx/friend/tag/friendDelTag friendIdList(repeated int64, 必填,客户id列表)tagIdList(repeated int64, 必填,标签id列表)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-单个客户设置标签 POST /api/wx/friend/tag/friendSetTag friendId(int64, 必填,客户id)tagIdList(repeated int64, 必填,标签id列表)original(string, 可选,打标来源:客服系统 customer);botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签分组列表 POST /api/wx/friend/tag/group/list botType(int32, 必填,类型 1 个微 2企微) list(repeated FriendTagGroupItem)
标签-创建标签分组 POST /api/wx/friend/tag/group/create botType(int32, 必填,类型 1 个微 2企微);name(string, 必填,分组名) id(int64id)
标签-标签分组信息更新 POST /api/wx/friend/tag/group/update id(int64, 必填,id)name(string, 必填,分组名称)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签分组删除 POST /api/wx/friend/tag/group/del id(int64, 必填,id)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-标签移进或者移出某个分组 POST /api/wx/friend/tag/setGroup tagIds(repeated int64, 必填,标签ids)groupId(int64, 必填,标签分组id)isDelete(bool, 可选,true就移出分组)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
标签-导入官方标签的客户 POST /api/wx/friend/tag/import/friend ids(repeated int64, 必填,ids)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
企微标签-同步 POST /api/wx/friend/tag/qwTag/sync botId(int64, 必填,机器人id)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
企业标签-列表 POST /api/wx/friend/tag/qwTag/list corpId(string, 必填,企业id)botId(int64, 可选,微号id)botType(int32, 必填,类型 1 个微 2企微) groupList(repeated HttpQwTagListGroup,组列表)
企业标签-添加客户 POST /api/wx/friend/tag/qwTag/friendAdd friendIdList(repeated int64, 必填,客户id列表)tagIds(repeated string, 必填,标签数组)botId(int64, 必填,微号id)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
企业标签-删除客户 POST /api/wx/friend/tag/qwTag/friendDel friendIdList(repeated int64, 必填,客户id列表)tagIds(repeated string, 必填,标签数组)botId(int64, 必填,微号id)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据
企业标签-同步标签下的所有联系人 POST /api/wx/friend/tag/qwTag/friendSync id(string, 必填,标签id)botId(int64, 必填,微号id)botType(int32, 必填,类型 1 个微 2企微) 空对象或无业务数据

常用示例

# 客户列表(企微 botType:2 必传 corpIdCORP_ID 可从 /api/bot/wx/corp/list 返回项的 id 获取)
htsy-cli call /api/wx/friend/list -d '{"page":1,"pageSize":20,"botType":2,"corpId":"CORP_ID"}'
# 客户详情
htsy-cli call /api/wx/friend/get -d '{"id":2002,"botType":2}'
# 设置客户备注(字段是 friendId 不是 idbotId 必填)
htsy-cli call /api/wx/friend/remark/set -d '{"friendId":2002,"remark":"重要客户","botType":2,"botId":1001}'
# 标签列表
htsy-cli call /api/wx/friend/tag/list -d '{"page":1,"pageSize":50,"botType":2}'