Customer
Customer List
GET ***/api/v1/customer/list?token=**&userId=**¤t=1&pageSize=10
Request parameters
name | type | required | description |
---|
token | string | yes | token for authorization |
current | Number | yes | current page |
pageSize | Number | yes | page size |
userId | string | no | corp user id, if this is empty, API will return back customers of all corp users |
TIP
- pageSize is data count for each page, max is 1000.
Sample Response data:
{
errcode: 0,
errmsg: 'ok'
data:[{
externalUserId: 'wmfvEMCAAAPHR9XslvYqTFgCJTULiZgg',
unionId: 'ozynqsulJFCZ2z1aYeS8h-nuasdAAA',
name: '李四',
avatar:'http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0',
gender: 1,
type: 1,
followUser: [{
userId: ‘rocky’,
name: ‘张三’,
remark: '张总',
avatar: 'http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0',
createTimestamp: 1604048292000,
tags: [{
groupName: '标签组名',
tagName: '标签名',
type: '1',
tagId: 'etDodGBwAA-rmc_3HDr84OnvfycgOQQQ'
}, {
groupName: '个人标签',
tagName: '个人标签名',
type: '2'
}]
}]
}],
total: 100
}
Description
name | type | required | description |
---|
errcode | number | yes | return code |
errmsg | string | yes | error message |
data.unionId | string | no | customer unionId |
data.externalUserId | string | yes | customer id |
data.name | string | yes | customer name |
data.avatar | string | no | customer avatar |
data.gender | number | yes | customer gender 0 unknown 1 male 2 female |
data.type | number | yes | customer type 1 WeChat 2 WeCom |
data.followUser.userId | string | yes | the corp user id which is added as the friend inside corp |
data.followUser.name | string | yes | the corp user name |
data.followUser.avatar | string | no | the corp user avatar |
data.followUser.remark | string | yes | the remark that the corp user put on the customer |
data.followUser.createTimestamp | number | yes | the timestamp that the customer added the corp user |
data.followUser.tags | array | yes | tags that the corp user put on the customer |
data.followUser.tags.groupName | string | yes | the tag group name, each tag has to be in a tag group |
data.followUser.tags.tagName | string | yes | the tag name |
data.followUser.tags.type | string | yes | the tag type 1 corp tag, 2 personal tag |
data.followUser.tags.tagId | string | no | the tag id, only available when the tag type is 1 |
total | number | yes | customer total count |
Customer Detail
GET ***/api/v1/customer/detail?token=**
Request Parameters
name | type | required | description |
---|
token | string | yes | token for authorization |
unionId | string | no | customer unionId |
externalUserId | string | customer external user id | |
TIP
unionId
and externalUserId
has to have at least one. unionId
will take affected when both id exist
Sample Response Data:
{
errcode: 0,
errmsg: 'ok'
data: {
externalUserId: 'wmfvEMCAAAPHR9XslvYqTFgCJTULiZgg',
unionId: 'ozynqsulJFCZ2z1aYeS8h-nuasdAAA',
name: '李四',
avatar:'http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0',
gender: 1,
type: 1,
followUser: [{
userId: ‘rocky’,
name: ‘张三’,
remark: '张总',
avatar: 'http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0',
createTimestamp: 1604048292000,
tags: [{
groupName: '标签组名',
tagName: '标签名',
type: '1',
tagId: 'etDodGBwAA-rmc_3HDr84OnvfycgOQQQ'
}, {
groupName: '个人标签',
tagName: '个人标签名',
type: '2'
}]
}]
}
}
Description:
name | type | required | description |
---|
errcode | number | yes | return code |
errmsg | string | yes | error message |
data.unionId | string | no | customer unionId |
data.externalUserId | string | yes | customer id |
data.name | string | yes | customer name |
data.avatar | string | no | customer avatar |
data.gender | number | yes | customer gender 0 unknown 1 male 2 female |
data.type | number | yes | customer type 1 WeChat 2 WeCom |
data.followUser.userId | string | yes | the corp user id which is added as the friend inside corp |
data.followUser.name | string | yes | the corp user name |
data.followUser.avatar | string | no | the corp user avatar |
data.followUser.remark | string | yes | the remark that the corp user put on the customer |
data.followUser.createTimestamp | number | yes | the timestamp that the customer added the corp user |
data.followUser.tags | array | yes | tags that the corp user put on the customer |
data.followUser.tags.groupName | string | yes | the tag group name, each tag has to be in a tag group |
data.followUser.tags.tagName | string | yes | the tag name |
data.followUser.tags.type | string | yes | the tag type 1 corp tag, 2 personal tag |
data.followUser.tags.tagId | string | no | the tag id, only available when the tag type is 1 |
POST ***/api/v1/customer/set_remark?token=***
Sample Request data:
{
remark_list:[
{
userId: 'zhangsan',
unionId:"ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
remark:'备注信息',
description: '描述信息'
}
]
}
Description:
name | type | required | description |
---|
token | stirng | yes | token for authorization |
userId | string | yes | corp user id |
unionId | string | yes | customer unionId |
remark | string | no | remark, max length 20 |
description | string | no | description, max length 150 |
TIP
- remark and description can not be empty at the same request
- batch update supports 50 items at most
Sample Response data:
{
errcode: 0,
errmsg: "ok"
fail_list:[
{
userId: 'zhangsan',
unionId:"ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
remark:'备注信息',
description: '描述信息'
errmsg:''
errcode: ''
}
]
}
Error Code:
code | description |
---|
-1 | remark exceed the limit |
-2 | description exceed the limit |
Description:
name | type | required | description |
---|
errcode | number | yes | return code |
errmsg | string | yes | error message |
fail_list | array | no | failed list which contains failed operation |
fail_list.userId | string | yes | the corp user id |
fail_list.unionId | string | yes | the customer unionId |
fail_list.remark | string | no | the remark |
fail_list.description | string | no | the description |
fail_list.errcode | string | yes | error code from WeCom |
fail_list.errmsg | string | yes | error message from WeCom |
WARNING
fail_list
is the list contains all failed operations, if all operations completes successfully, there will be no fail_list
Add Follow History
POST ***/api/v1/customer/add_follow?token=***
Sample Request data:
{
"follow_list": [{
unionId: "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
userId: 'rocky',
text: [{
content: '这是跟进记录1',
timestamp: 1602667647
}, {
content: '这是跟进记录2'
}]
}]
}
Description
name | type | required | description |
---|
follow_list.unionId | string | yes | customer unionId |
follow_list.userId | string | yes | corp user id |
follow_list.text.content | string | yes | the content of the follow history |
follow_list.text.timestamp | number | no | the timestamp of the follow history |
TIP
- follow_list max length is 500.
Sample Response data:
{
errcode: 0,
errmsg: "ok"
fail_list:[{
userId: 'zhangsan',
unionId: "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
text: [{
content: '这是跟进记录1',
timestamp: 1602667647
}, {
content: '这是跟进记录2'
}]
}]
}
Description
name | type | required | description |
---|
errcode | number | yes | return code |
errmsg | string | yes | error message |
fail_list | array | no | failed list which contains failed operation |
fail_list.unionId | string | yes | customer unionId |
fail_list.userId | string | yes | corp user id |
fail_list.text.content | string | yes | the content of the follow history |
fail_list.text.timestamp | number | 否 | timestamp of the follow history |
WARNING
fail_list
is the list contains all failed operations, if all operations completes successfully, there will be no fail_list