Customer

Customer List

GET ***/api/v1/customer/list?token=**&userId=**&current=1&pageSize=10

Request parameters

nametyperequireddescription
tokenstringyestoken for authorization
currentNumberyescurrent page
pageSizeNumberyespage size
userIdstringnocorp user id, if this is empty, API will return back customers of all corp users

TIP

  1. 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

nametyperequireddescription
errcodenumberyesreturn code
errmsgstringyeserror message
data.unionIdstringnocustomer unionId
data.externalUserIdstringyescustomer id
data.namestringyescustomer name
data.avatarstringnocustomer avatar
data.gendernumberyescustomer gender 0 unknown 1 male 2 female
data.typenumberyescustomer type 1 WeChat 2 WeCom
data.followUser.userIdstringyesthe corp user id which is added as the friend inside corp
data.followUser.namestringyesthe corp user name
data.followUser.avatarstringnothe corp user avatar
data.followUser.remarkstringyesthe remark that the corp user put on the customer
data.followUser.createTimestampnumberyesthe timestamp that the customer added the corp user
data.followUser.tagsarrayyestags that the corp user put on the customer
data.followUser.tags.groupNamestringyesthe tag group name, each tag has to be in a tag group
data.followUser.tags.tagNamestringyesthe tag name
data.followUser.tags.typestringyesthe tag type 1 corp tag, 2 personal tag
data.followUser.tags.tagIdstringnothe tag id, only available when the tag type is 1
totalnumberyescustomer total count

Customer Detail

GET ***/api/v1/customer/detail?token=**

Request Parameters

nametyperequireddescription
tokenstringyestoken for authorization
unionIdstringnocustomer unionId
externalUserIdstringcustomer external user id

TIP

  1. 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:

nametyperequireddescription
errcodenumberyesreturn code
errmsgstringyeserror message
data.unionIdstringnocustomer unionId
data.externalUserIdstringyescustomer id
data.namestringyescustomer name
data.avatarstringnocustomer avatar
data.gendernumberyescustomer gender 0 unknown 1 male 2 female
data.typenumberyescustomer type 1 WeChat 2 WeCom
data.followUser.userIdstringyesthe corp user id which is added as the friend inside corp
data.followUser.namestringyesthe corp user name
data.followUser.avatarstringnothe corp user avatar
data.followUser.remarkstringyesthe remark that the corp user put on the customer
data.followUser.createTimestampnumberyesthe timestamp that the customer added the corp user
data.followUser.tagsarrayyestags that the corp user put on the customer
data.followUser.tags.groupNamestringyesthe tag group name, each tag has to be in a tag group
data.followUser.tags.tagNamestringyesthe tag name
data.followUser.tags.typestringyesthe tag type 1 corp tag, 2 personal tag
data.followUser.tags.tagIdstringnothe tag id, only available when the tag type is 1

Modify Customer Remark

POST ***/api/v1/customer/set_remark?token=***

Sample Request data:

{
  remark_list:[
    {
      userId: 'zhangsan',
      unionId:"ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
      remark:'备注信息',
      description: '描述信息'
    }
  ]
}

Description:

nametyperequireddescription
tokenstirngyestoken for authorization
userIdstringyescorp user id
unionIdstringyescustomer unionId
remarkstringnoremark, max length 20
descriptionstringnodescription, max length 150

TIP

  1. remark and description can not be empty at the same request
  2. 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:

codedescription
-1remark exceed the limit
-2description exceed the limit

Description:

nametyperequireddescription
errcodenumberyesreturn code
errmsgstringyeserror message
fail_listarraynofailed list which contains failed operation
fail_list.userIdstringyesthe corp user id
fail_list.unionIdstringyesthe customer unionId
fail_list.remarkstringnothe remark
fail_list.descriptionstringnothe description
fail_list.errcodestringyeserror code from WeCom
fail_list.errmsgstringyeserror 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

nametyperequireddescription
follow_list.unionIdstringyescustomer unionId
follow_list.userIdstringyescorp user id
follow_list.text.contentstringyesthe content of the follow history
follow_list.text.timestampnumbernothe timestamp of the follow history

TIP

  1. 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

nametyperequireddescription
errcodenumberyesreturn code
errmsgstringyeserror message
fail_listarraynofailed list which contains failed operation
fail_list.unionIdstringyescustomer unionId
fail_list.userIdstringyescorp user id
fail_list.text.contentstringyesthe content of the follow history
fail_list.text.timestampnumbertimestamp 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

Latest update:
Contributors: windmemory