API Callback

TIP

The callback will retry 5 times if the call is failed

The interval from begin to end will be 1, 4, 9, 16, 25 seconds

Test environment endpoint:https://crm.testing.pipacoding.com

Corp User Added

POST  /crm-botorange/v1/notify/add/user

Request Header:

sign=body+token signature

Request Body:

{
  type: 'create_user',
  event: {
    AuthCorpId: 'corpId',
    InfoType: 'change_contact',
    TimeStamp: '123',
    ChangeType: 'create_user',
    UserID: 'userId',
    Status: '1',
  },
  data: {
    userId: 'peter',
    name: 'Peter',
    email: 'peter@163.com',
    isLogin: true,
    avatar: 'http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0'
  },
  timestamp: 123
}

Parameter description:

nametyperequireddescription
typestringyesfixed as create_user
event.AuthCorpIdstringyescorporation id
event.InfoTypestringyesfixed as change_contact
event.TimeStampstringyestimestamp
event.ChangeTypestringyesfixed as create_user
event.UserIDstringyesuserId
event.Statusstringyesactive status 1=active,2=disabled,4=inactive,5=exit the corp
data.userIdstringyesuser id
data.namestringnoname
data.emailstringnoemail
data.isLoginbooleanyeswhether the user is logged in to Juzi Miaohui
data.avatarstringnoavatar of the user
timestampnumberyesin milliseconds

Response:

{
  errCode: 0
}


MiaoHui Login

POST /crm-botorange/v1/notify/login/user

Request header

sign=body+token signature

Sample request body:

{
  type: 'login_user',
  data: {
    userId: 'zhangsan',
    name: '张三',
    email: 'zhangsan@163.com',
    isLogin: true,
    avatar: 'http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0'
  },
  timestamp: 123
}

description

nametyperequireddescription
typestringyesfixed as login_user
data.userIdstringyesuser id
data.namestringnouser name
data.emailstringnouser email
data.avatarstringnouser avatar
data.isLoginbooleanyesis user logged into miaohui
timestampnumberyestimestamp in millisecond, utc

Response sample data:

{
  errCode: 0
}


Customer Added

POST /crm-botorange/v1/notify/add/customer

Request header:

sign=body+token signature

Sample request body:

{
  type: 'add_external_contact',
  event: {
    "ToUserName":"ww02f212d73c9dd123",
    "FromUserName":"sys",
    "CreateTime":"1597931626",
    "MsgType":"event",
    "Event":"change_external_contact",
    "ChangeType":"add_external_contact",
    "UserID":"rocky",
    "ExternalUserID":"wm0ZoZBwAAVinZ739MvTpccHQkHQx3gA",
    "State":"8ff9cf31-98ce-4cce-88b3-53d123",
    "WelcomeCode":"lUdrUtUN2lXUGPee0AhccvmOs0NI1foXdDZMk8qf123"
  },
  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'
      }]
  },
  timestamp: 123
}


description

nametyperequireddescription
typestringyesfixed as add_external_contact
event.ToUserNamestringyescorp id
event.FromUserNamestringyesfixed as sys
event.CreateTimestringyesthe event create time in seconds
event.MsgTypestringyesfixed as event
event.Eventstringyesfixed as change_external_contact
event.ChangeTypestringyesfixed as add_external_contact
event.UserIDstringyesthe corp user id which is added as the friend inside corp
event.ExternalUserIDstringyesthe customer id that is newly added
event.Statestringnothe state, indicate how the customer added the user
event.WelcomeCodestringnowelcome code, used for sending welcome message
data.unionIdstringnocustomer unionId
data.externalUserIdstringyesthe customer id that is newly added
data.namestringyescustomer name
data.avatarstringnocustomer avatar
data.gendernumberyescustomer gender 0 unknown 1 male 2 female
data.typenumberyescustomer type 1 WeChat user 2 WeCom user
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
timestampnumberyestimestamp in milliseconds, utc

Sample Response data:

{
  errCode: 0
}


Customer info changed

POST /crm-botorange/v1/notify/change/customer/info

Request header

sign=body+token signature

Sample Request body:

{
  type: 'edit_external_contact',
  event: {
    ToUserName: "ww27f158d9319a1234",
    FromUserName: "sys",
    CreateTime: "1597931626",
    MsgType: "event",
    Event: "change_external_contact",
    ChangeType: "edit_external_contact",
    UserID: "rocky",
    ExternalUserID: "wm6_UVDwAAPDG_9bTuPiv_8NxaH91234"
  },
  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'
      }]
    }]
  },
  timestamp: 123
}

Description

nametyperequireddescription
typestringyesfixed as edit_external_contact
event.ToUserNamestringyescorp id
event.FromUserNamestringyesfixed as sys
event.CreateTimestringyesthe event create time in seconds
event.MsgTypestringyesfixed as event
event.Eventstringyesfixed as change_external_contact
event.ChangeTypestringyesfixed as edit_external_contact
event.UserIDstringyesthe corp user id which is added as the friend inside corp
event.ExternalUserIDstringyesthe customer id that is newly added
data.unionIdstringnocustomer unionId
data.externalUserIdstringyesthe customer id that is newly added
data.namestringyescustomer name
data.avatarstringnocustomer avatar
data.gendernumberyescustomer gender 0 unknown 1 male 2 female
data.typenumberyescustomer type 1 WeChat user 2 WeCom user
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
timestampnumberyestimestamp in milliseconds, utc

Sample Response data:

{
  errCode: 0
}
Latest update:
Contributors: windmemory