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:
name | type | required | description |
---|---|---|---|
type | string | yes | fixed as create_user |
event.AuthCorpId | string | yes | corporation id |
event.InfoType | string | yes | fixed as change_contact |
event.TimeStamp | string | yes | timestamp |
event.ChangeType | string | yes | fixed as create_user |
event.UserID | string | yes | userId |
event.Status | string | yes | active status 1=active,2=disabled,4=inactive,5=exit the corp |
data.userId | string | yes | user id |
data.name | string | no | name |
data.email | string | no | |
data.isLogin | boolean | yes | whether the user is logged in to Juzi Miaohui |
data.avatar | string | no | avatar of the user |
timestamp | number | yes | in 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
name | type | required | description |
---|---|---|---|
type | string | yes | fixed as login_user |
data.userId | string | yes | user id |
data.name | string | no | user name |
data.email | string | no | user email |
data.avatar | string | no | user avatar |
data.isLogin | boolean | yes | is user logged into miaohui |
timestamp | number | yes | timestamp 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
name | type | required | description |
---|---|---|---|
type | string | yes | fixed as add_external_contact |
event.ToUserName | string | yes | corp id |
event.FromUserName | string | yes | fixed as sys |
event.CreateTime | string | yes | the event create time in seconds |
event.MsgType | string | yes | fixed as event |
event.Event | string | yes | fixed as change_external_contact |
event.ChangeType | string | yes | fixed as add_external_contact |
event.UserID | string | yes | the corp user id which is added as the friend inside corp |
event.ExternalUserID | string | yes | the customer id that is newly added |
event.State | string | no | the state, indicate how the customer added the user |
event.WelcomeCode | string | no | welcome code, used for sending welcome message |
data.unionId | string | no | customer unionId |
data.externalUserId | string | yes | the customer id that is newly added |
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 user 2 WeCom user |
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 |
timestamp | number | yes | timestamp 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
name | type | required | description |
---|---|---|---|
type | string | yes | fixed as edit_external_contact |
event.ToUserName | string | yes | corp id |
event.FromUserName | string | yes | fixed as sys |
event.CreateTime | string | yes | the event create time in seconds |
event.MsgType | string | yes | fixed as event |
event.Event | string | yes | fixed as change_external_contact |
event.ChangeType | string | yes | fixed as edit_external_contact |
event.UserID | string | yes | the corp user id which is added as the friend inside corp |
event.ExternalUserID | string | yes | the customer id that is newly added |
data.unionId | string | no | customer unionId |
data.externalUserId | string | yes | the customer id that is newly added |
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 user 2 WeCom user |
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 |
timestamp | number | yes | timestamp in milliseconds, utc |
Sample Response data:
{
errCode: 0
}