# Tag

# Tag List

GET ***/api/v1/tag/list?token=***&isSync=false

# Description:

name type required description
token string yes token for authorization
isSync boolean no whether trigger a tag sync operation to WeCom

TIP

  1. When isSync is enabled, JuziBot will sync tag info from WeCom, which will take longer time
  2. Don't call API with isSync enabled frequently

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
  data:[
   {
     id: 'et1LpcCQAAGLd4xufTKt4l9ERbTTQQQQ',
     name: '标签组名',
     createTimestamp: 1601274190000,
     order: 0,
     tags:[{
       id: 'etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw',
       name: '标签名',
       createTimestamp: 1601274190000,
       order: 0,
     }]
   }
  ]
}

# Description:

name type required description
errcode number yes return code
errmsg string yes error message
data.id string yes tag group id
data.name string yes tag group name
data.createTimestamp yes number tag group create timestamp in milliseconds, 0 for no timestamp
data.order number yes tag group order, larger number will be before smaller number, number range [0, 2^32)
data.tags.id string yes tag id
data.tags.name string yes tag name
data.tags.createTimestamp number yes tag create timestamp in milliseconds, 0 for no timestamp
data.tags.order number yes tag order, larger number will be before smaller number, number range [0, 2^32)

TIP

The 0 value for createTimestamp means not exists, which will exist after a sync

# Tag Detail

GET /api/v1/tag/detail?token=***&tagId=etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw

# Description

name type required description
token string token for authorization
tagId string tag id

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
  data:[
   {
     id: 'et1LpcCQAAGLd4xufTKt4l9ERbTTQQQQ',
     name: '标签组名',
     createTimestamp: 1601274190000,
     order: 0,
     tags:[{
       id: 'etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw',
       name: '标签名',
       createTimestamp: 1601274190000,
       order: 0,
     }]
   }
  ]
}

# Description:

name type required description
errcode number yes return code
errmsg string yes error message
data.id string yes tag group id
data.name string yes tag group name
data.createTimestamp yes number tag group create timestamp in milliseconds, 0 for no timestamp
data.order number yes tag group order, larger number will be before smaller number, number range [0, 2^32)
data.tags.id string yes tag id
data.tags.name string yes tag name
data.tags.createTimestamp number yes tag create timestamp in milliseconds, 0 for no timestamp
data.tags.order number yes tag order, larger number will be before smaller number, number range [0, 2^32)

TIP

The 0 value for createTimestamp means not exists, which will exist after a sync

# Create Tag

POST ***/api/v1/tag/create?token=***

# Sample Request Data:

{
  groupId: 'et1LpcCQAAGLd4xufTKt4l9ERbTTQQQQ',
  groupName: '标签组名',
  tag: [{
    name: '标签名',
  }]
}

# Description:

name type required description
token string token for authorization
groupId string tag group id
groupName string tag group name, max length 30
tag.name string new tag name, max length 30

TIP

  1. To add a tag to a given tag group, groupId is required.
  2. To create a tag with new tag group, groupName is required. If the groupName already exists, the tag will be added to the tag group.
  3. If groupId is available, groupName will be ignored.
  4. It is not allowed to create an empty tag group.
  5. Tags within same tag group can not have same tag name, if passed in duplicate tag name, only one tag will be created.

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
  data:[
   {
     id: 'et1LpcCQAAGLd4xufTKt4l9ERbTTQQQQ',
     name: '标签组名',
     createTimestamp: 1601274190000,
     order: 0,
     tags:[{
       id: 'etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw',
       name: '标签名',
       createTimestamp: 1601274190000,
       order: 0,
     }]
   }
  ]
}

# 参数说明:

name type required description
errcode number yes return code
errmsg string yes error message
data.id string yes tag group id
data.name string yes tag group name
data.createTimestamp yes number tag group create timestamp in milliseconds, 0 for no timestamp
data.order number yes tag group order, larger number will be before smaller number, number range [0, 2^32)
data.tags.id string yes tag id
data.tags.name string yes tag name
data.tags.createTimestamp number yes tag create timestamp in milliseconds, 0 for no timestamp
data.tags.order number yes tag order, larger number will be before smaller number, number range [0, 2^32)

TIP

The 0 value for createTimestamp means not exists, which will exist after a sync

# Error Code

code description
-1 invalid tag group name
-2 no permission to tag group
-3 tag group name exceed max length
-4 tag name exceed max length

# Update Tag Group

POST ***/api/v1/tagGroup/edit?token=***

# Sample Request Data:

{
  id: 'et1LpcCQAAGLd4xufTKt4l9ERbTTQQQQ',
  name: '标签组名',
  order: 123
}

# Description:

name type required description
token string yes token for authorization
id string yes tag group id
name string no tag group name, max length 30
order number no tag group order, larger number will be before smaller number, number range [0, 2^32)

TIP

  1. name and order can not be empty at the same time.
  2. The name is duplicate with other tag group, the request will be failed.

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
}

# Description:

name type required description
errcode number yes return code
errmsg string yes error message

# Error Code

code description
-2 no permission to tag group
-3 tag group name exceed max length
-4 tag name exceed max length

# Update Tag

POST ***/api/v1/tag/edit?token=***

# Sample Request Data:

{
  id: 'etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw',
  name: '标签名',
  order: 123
}

# Description:

name type required description
token string yes token for authorization
id string yes tag id
name string no tag name, max length 30
order number no tag order, larger number will be before smaller number, number range [0, 2^32)

TIP

  1. name and order can not be empty at the same time.
  2. The name is duplicate with other tag in the same group, the request will be failed.

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
}

# Description:

name type required description
errcode number yes return code
errmsg string yes error message

# Error Code

code description
-2 no permission to tag group
-4 tag name exceed max length

# Delete Tag Group

POST ***/api/v1/tagGroup/delete?token=***

# Sample Request Data:

{
  id: ['et1LpcCQAAGLd4xufTKt4l9ERbTTQQQQ']
}

# Description:

name type required description
token string yes token for authorization
id string[] yes tag group id list

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
}

# Description

name type required description
errcode number yes return code
errmsg string yes error message

# Error Code

code decription
-2 no permission to tag group

# Delete Tag

POST ***/api/v1/tag/delete?token=***

# Sample Request Data:

{
  id: ['etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw']
}

# Description:

name type required description
token string yes token for authorization
id string[] yes tag id list

WARNING

If all tags in a tag group is deleted, the tag group will be automatically deleted

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
}

# Description:

name type required description
errcode number yes return code
errmsg string yes error message

# Error Code

code decription
-2 no permission to tag group

# Update Customer Tag

POST ***/api/v1/tag/mark?token=***

# Sample Request Data:

{
  mark_list: [{
    unionId: "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
    userId: 'rocky',
    addTagId: ['etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw'],
    delTagId: ['etrRhyBgAAwVm8uMyEc0EMZI1HwmHwmw']
  }]
}

# Description:

name type required description
token string yes token for authorization
mark_list.unionId string yes customer unionId
mark_list.userId string yes corp user id
mark_list.addTagId string[] no the tag list to be added
mark_list.delTagId string[] no the tag list to be removed

TIP

  1. Please make sure the customer is a friend of the user
  2. addTagId and delTagId can not be empty at the same time.

# Sample Response Data:

{
  errcode: 0,
  errmsg: "ok"
}

# Description

name type required description
errcode number yes return code
errmsg string yes error message
Latest update: 5/25/2022, 9:35:39 PM