API回调

TIP

回调会重试5次,间隔分别是1,4,9,16, 25秒 测试环境域名:https://crm.testing.pipacoding.com

新增客户

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

请求参数Header:

sign=body+token 签名

请求参数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": {
    "unionId": "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
    "name": "李四",
    "avatar": "http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0",
    "externalUserId": "wmfvEMCAAAPHR9XslvYqTFgCJTULiZgg",
    "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"
          }
        ],
        "remarkMobiles": [
          "12123123"
        ]
      }
    ]
  },
  "timestamp": 123
}

参数说明:

名称类型必定存在备注
typestring固定为add_external_contact
event.ToUserNamestring企业id
event.FromUserNamestring固定sys
event.CreateTimestring添加时间 (秒)
event.MsgTypestring固定event
event.Eventstring固定change_external_contact
event.ChangeTypestring固定add_external_contact/add_half_external_contact
event.UserIDstring成员id
event.ExternalUserIDstring客户id
event.Statestring添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
event.WelcomeCodestring欢迎语code,可用于发送欢迎语
data.unionIdstring客户unionId
data.externalUserIdstring客户id
data.namestring客户姓名
data.avatarstring客户头像
data.gendernumber客户性别 0 -未知 1 -男性 2 -女性
data.typenumber客户的类型,1 表示该客户是微信用户,2 表示该客户是企业微信用户
data.followUser.userIdstring员工在企业微信中的userId
data.followUser.namestring员工姓名
data.followUser.avatarstring员工头像
data.followUser.remarkstring当前员工给当前客户打的备注信息
data.followUser.createTimestampnumber客户添加该员工时间戳(毫秒)
data.followUser.tags.groupNamestring该成员添加此客户所打标签的分组名称(标签功能需要企业微信升级到2.7.5及以上版本)
data.followUser.tags.tagNamestring该成员添加此客户所打标签名称
data.followUser.tags.typestring该成员添加此客户所打标签类型, 1-企业设置, 2-用户自定义
data.followUser.tags.tagIdstring该成员添加此客户所打企业标签的id,仅企业设置(type为1)的标签返回
data.followUser.remarkMobilesstring[]该成员对此客户备注的手机号码
timestampnumber时间戳 (毫秒)

返回示例:

{
  "errCode": 0
}

客户信息变更

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

请求参数Header:

sign=body+token 签名

请求参数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",
    "State": "8ff9cf31-98ce-4cce-88b3-53d123",
  },
  "data": {
    "unionId": "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
    "name": "李四",
    "avatar": "http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0",
    "externalUserId": "wmfvEMCAAAPHR9XslvYqTFgCJTULiZgg",
    "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"
          }
        ],
        "remarkMobiles": [
          "12123123"
        ]
      }
    ]
  },
  "timestamp": 123
}

参数名称:

名称类型必定存在备注
typestring固定为edit_external_contact
event.ToUserNamestring企业id
event.FromUserNamestring固定sys
event.CreateTimestring添加时间 (秒)
event.MsgTypestring固定event
event.Eventstring固定change_external_contact
event.ChangeTypestring固定edit_external_contact
event.UserIDstring成员id
event.ExternalUserIDstring客户id
event.Statestring添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
data.unionIdstring客户unionId
data.externalUserIdstring客户id
data.namestring客户姓名
data.avatarstring客户头像
data.gendernumber客户性别 0 -未知 1 -男性 2 -女性
data.typenumber客户的类型,1 表示该客户是微信用户,2 表示该客户是企业微信用户
data.followUser.userIdstring员工在企业微信中的userId
data.followUser.namestring员工姓名
data.followUser.avatarstring员工头像
data.followUser.remarkstring当前员工给当前客户打的备注信息
data.followUser.createTimestampnumber客户添加该员工时间戳(毫秒)
data.followUser.tags.groupNamestring该成员添加此客户所打标签的分组名称(标签功能需要企业微信升级到2.7.5及以上版本)
data.followUser.tags.tagNamestring该成员添加此客户所打标签名称
data.followUser.tags.typestring该成员添加此客户所打标签类型, 1-企业设置, 2-用户自定义
data.followUser.tags.tagIdstring该成员添加此客户所打企业标签的id,仅企业设置(type为1)的标签返回
data.followUser.remarkMobilesstring[]该成员对此客户备注的手机号码
timestampnumber时间戳 (毫秒)

返回示例:

{
  "errCode": 0
}

删除客户或者被客户删除

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

请求参数Header:

sign=body+token 签名

请求参数Body:

{
  "type": "del_external_contact",
  "event": {
    "ToUserName": "ww02f212d73c9dd123",
    "FromUserName": "sys",
    "CreateTime": "1597931626",
    "MsgType": "event",
    "Event": "change_external_contact",
    "ChangeType": "del_external_contact",
    "UserID": "rocky",
    "ExternalUserID": "wm0ZoZBwAAVinZ739MvTpccHQkHQx3gA"
  },
  "data": {
    "unionId": "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
    "name": "李四",
    "avatar": "http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0",
    "externalUserId": "wmfvEMCAAAPHR9XslvYqTFgCJTULiZgg",
    "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"
          }
        ],
        "remarkMobiles": [
          "12123123"
        ]
      }
    ]
  },
  "timestamp": 123
}

参数说明:

名称类型必定存在备注
typestring固定为add_external_contact
event.ToUserNamestring企业id
event.FromUserNamestring固定sys
event.CreateTimestring添加时间 (秒)
event.MsgTypestring固定event
event.Eventstring固定change_external_contact
event.ChangeTypestring固定del_external_contact/del_follow_user
event.UserIDstring成员id
event.ExternalUserIDstring客户id
data.unionIdstring客户unionId
data.externalUserIdstring客户id
data.namestring客户姓名
data.avatarstring客户头像
data.gendernumber客户性别 0 -未知 1 -男性 2 -女性
data.typenumber客户的类型,1 表示该客户是微信用户,2 表示该客户是企业微信用户
data.followUser.userIdstring员工在企业微信中的userId
data.followUser.namestring员工姓名
data.followUser.avatarstring员工头像
data.followUser.remarkstring当前员工给当前客户打的备注信息
data.followUser.createTimestampnumber客户添加该员工时间戳(毫秒)
data.followUser.tags.groupNamestring该成员添加此客户所打标签的分组名称(标签功能需要企业微信升级到2.7.5及以上版本)
data.followUser.tags.tagNamestring该成员添加此客户所打标签名称
data.followUser.tags.typestring该成员添加此客户所打标签类型, 1-企业设置, 2-用户自定义
data.followUser.tags.tagIdstring该成员添加此客户所打企业标签的id,仅企业设置(type为1)的标签返回
data.followUser.remarkMobilesstring[]该成员对此客户备注的手机号码
timestampnumber时间戳 (毫秒)

返回示例:

{
  "errCode": 0
}

秒回数据同步

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

请求参数Header:

sign=body+token 签名

请求参数Body:

{
  "chatId": "5c6a35f629a2d9f8fcced6d0",
  "unionId": "ozynqsulJFCZ2z1aYeS8h-nuasdAAA",
  "externalUserId": "wmfvEMCAAAPHR9XslvYqTFgCJTULiZgg",
  "userId": "rocky",
  "name": "李四",
  "avatar": "http://p.qlogo.cn/bizmail/IcsdgagqefergqerhewSdage/0",
  "wxid": "12321312"
}

参数名称:

名称类型必定存在备注
chatIdstring可用调用秒回api接口进行消息发送
unionIdstring客户unionId
namestring客户姓名
externalUserIdstring客户id
avatarstring客户头像
userIdstring员工的userId
wxidstring客户的wxid

返回示例:

{
  "errCode": 0
}
最近更新:
Contributors: windmemory