数据推送

目录

概述

为了满足合作伙伴对客户数据以及行为数据的备份和BI分析等需求,KuickDeal开发了数据推送功能,每一个项目可以配置一到多个回调地址,当KuickDeal系统内有客户创建、修改、合并等事件、以及客户行为事件产生时,KuickDeal会将该事件通过项目配置的回调地址推送到合作伙伴的系统。

配置推送地址

请求地址

POST https://deal-api.kuick.cn/api/v1.7/app/{app-id}/event-hooks

是否需要认证

参数说明

参数名称 参数类别 是否必填 参数说明
app-id string 项目id
参数名称 参数类别 是否必填 参数说明
hook_url string 接收事件推送地址

正常返回结果

{
    "status": 1,
    "data": {
        "id": "20bcb673-0bee-4425-b306-432d52523497",
        "appId": "e449db8a-d20a-434c-809b-3c8a71e278d0",
        "appSecret": null,
        "hookURL": "http://www.baidu.com",
        "hookSettings": "",
        "status": 1,
        "createdAt": "2018-06-29 18:23:10",
        "updatedAt": "2018-06-29 18:23:10",
        "enabled": true
    }
}

正常返回结果说明

字段名称 字段类型 字段说明
status int 接口调用状态,1:成功,0:失败
data jsonObj 接口返回结果对象
data.id string 记录id
data.appId string 项目id
data.appSecret string 项目秘钥,这里为空
data.hookURL string 接收事件推送地址
data.hookSettings string 推送地址设置,这里为空
data.status int 推送地址状态,1:正常,0:删除
data.createdAt datetime 记录创建时间
data.updatedAt datetime 记录编辑时间
data.enabled boolean 推送地址是否可用

推送签名校验规则

1、联系KuickDeal给某个项目配置推送回调地址hookURL,并获取项目的app_secret
2、当KuickDeal有行为产生时,会给配置的hookURL推送行为数据,格式如下:
POST ${hookURL}?app_id=${app-id}&timestamp=${timestamp}&sign=${sign}
参数说明
参数名称 参数类别 是否必填 参数说明
app_id string 项目ID
timestamp long 推送时间戳,即当前时间毫秒数
sign string 签名
3、行为数据以json的形式放在body中推送给hookURL
4、签名规则:
sign = md5(app_id + ":" + timestamp + ":" + 消息体 + ":" + app_secret)

其中消息体为推送给hookURL中的body中的行为数据
5、推送次数:

第一次推送失败后:1分钟、5分钟、20分钟会尝试重新推送,如果仍然没有推送成功,则不再推送。我们将提供API接口用于查询推送失败的数据。

推送消息体

注意:访客和客户行为的action以及对应的content说明,参考这里

客户创建消息格式

[
    {
        "event_type": "create",
        "domainType": "Customer",
        "body": {
            "city": null,
            "ageState": null,
            "groupId": null,
            "county": null,
            "utmContent": null,
            "industry": null,
            "intentionality": null,
            "source": "{\"origin\":\"deal_js_sdk\",\"context\":{}}",
            "title": "",
            "searchKeyword": null,
            "platform": null,
            "createdAt": "2018-02-07 10:45:48",
            "province": null,
            "kuickUserId": "xxx",
            "appId": "xxxx",
            "company": "",
            "from": null,
            "id": "xxxx",
            "email": "test@kuick.cn",
            "fromContentLink": null,
            "whetherMerge": 0,
            "updatedAt": "2018-02-07 10:45:48",
            "fromContentTitle": null,
            "address": null,
            "fromProvince": null,
            "buyedKeyword": null,
            "allocationData": {
                "allocationKuickUserId": "5188"
            },
            "leadSource": null,
            "sex": 2,
            "fixedPhone": null,
            "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/83308851-fcb0-4d6a-abab-a025f50a638a.png",
            "promoterId": null,
            "utmCampaign": null,
            "getWay": null,
            "phone": "18060000000",
            "grade": null,
            "name": "张三",
            "createWay": 1,
            "utmMedium": null,
            "fromCity": null,
            "status": 1
        },
        "domainId": "xxxx"
    }
]

字段说明

字段名称 字段类型 字段说明
event_type string 事件类型,创建客户时值为create
domainType string 领域类型,Customer:客户类型,BehaviourLog:行为类型
domainId string 领域对象记录id,即:领域类型为Customer时,domainId为客户id,领域类型为BehaviourLog时,domainId为行为记录id
body object 客户对象
id string 客户id
appId string 项目id
name string 客户姓名
headportraitUrl string 客户头像
company string 客户公司名称
title string 客户职位
phone string 客户手机号
email string 客户E-mail
kuickUserId string 客户所属人id,即KuickDeal用户id
groupId string 客户所属分组id
sex string 客户性别,0:女,1:男,2:未知
ageState int 客户年龄段, -1:未选择,0:25~35,1:35~45,2:45~55:,3:55~65,4:65以上
fixedPhone string 客户座机号
industry string 客户所属行业
province string 客户公司所在省份
city string 客户公司所在城市
county string 客户公司所在县区
address string 客户公司详细地址
intentionality int 客户意向度等级,默认值,1:低,2:中,3:高,可通过修改客户元数据进行变更
grade int 客户等级,默认值,1:A(重点客户),2:B(普通客户),3:C(非优先客户),可通过修改客户元数据进行变更
leadSource string 线索来源,默认值,400信息,陌拜信息,会员信息,转介绍信息,其他,可通过修改客户元数据进行变更
createWay int 客户创建方式,0:其他,1:登录,2:咨询客服,3:关注公众号,4:400电话,5:表单填写,6:手动创建,7:批量上传,8:销售易同步,9:CRM插件同步,11:注册
platform string 客户创建平台,pc_web:PC网站,mobile_web:移动网站,app:App,weixin:微信
from string utm来源
utmMedium string utm媒介
utmCampaign string utm活动
utmContent string utm内容
buyedKeyword string utm关键词
searchKeyword string 搜索词
promoterId string 推广人id
fromContentTitle string 来源内容标题
fromContentLink string 来源内容链接
fromProvince string 区域省份
fromCity string 区域城市
getWay int 获取方式,0:免费,1:付费
source string 来源json字符串,暂无其他意义
allocationData object 客户分配数据
allocationKuickUserId string 客户分配给KuickDeal用户id
status string 新客户状态,1:正常; 0:删除
whetherMerge string 标记该客户是否需要被合并。 1:需要;0:不需要
mergedCustomerId string 合并状态,为空时未合并; 非空时已合并,值为产生的新的客户ID
createdAt string 创建时间
updatedAt string 修改时间

客户编辑消息格式

[
    {
        "event_type": "update",
        "domainType": "Customer",
        "old_body": {
            "mergedCustomerId": null,
            "city": null,
            "groupId": null,
            "ageState": null,
            "county": null,
            "utmContent": null,
            "industry": null,
            "intentionality": null,
            "source": "{\"origin\":\"deal_js_sdk\",\"context\":{}}",
            "title": "",
            "searchKeyword": null,
            "platform": null,
            "createdAt": "2018-02-07 10:45:48",
            "province": null,
            "kuickUserId": "5188",
            "appId": "xxxx",
            "company": "",
            "from": null,
            "id": "xxxx",
            "email": "test@kuick.cn",
            "fromContentLink": null,
            "updatedAt": "2018-02-07 10:45:48",
            "fromContentTitle": null,
            "address": null,
            "fromProvince": null,
            "buyedKeyword": null,
            "leadSource": null,
            "sex": 2,
            "fixedPhone": null,
            "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/83308851-fcb0-4d6a-abab-a025f50a638a.png",
            "promoterId": null,
            "utmCampaign": null,
            "getWay": null,
            "phone": "18060000000",
            "grade": null,
            "name": "张三",
            "createWay": 1,
            "utmMedium": null,
            "fromCity": null,
            "status": 1
        },
        "body": {
            "mergedCustomerId": null,
            "city": null,
            "ageState": null,
            "groupId": null,
            "county": null,
            "utmContent": null,
            "industry": null,
            "intentionality": null,
            "source": "{\"origin\":\"deal_js_sdk\",\"context\":{}}",
            "title": "",
            "searchKeyword": "数据制作图表",
            "platform": "pc_web",
            "createdAt": "2018-02-07 10:45:48",
            "province": null,
            "kuickUserId": "5188",
            "appId": "xxxx",
            "company": "",
            "from": "https://www.baidu.com",
            "id": "3699fb90-5a96-4ca9-9583-4052277bce3c",
            "email": "test2@kuick.cn",
            "fromContentLink": null,
            "updatedAt": "2018-02-07 10:45:48",
            "fromContentTitle": null,
            "address": null,
            "fromProvince": "江苏",
            "buyedKeyword": null,
            "leadSource": null,
            "sex": 2,
            "fixedPhone": null,
            "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/83308851-fcb0-4d6a-abab-a025f50a638a.png",
            "promoterId": null,
            "utmCampaign": null,
            "getWay": null,
            "phone": "18060000000",
            "grade": null,
            "name": "李四",
            "createWay": 1,
            "utmMedium": null,
            "fromCity": "苏州",
            "status": 1
        },
        "domainId": "xxxx"
    }
]

字段说明

字段名称 字段类型 字段说明
event_type string 事件类型,编辑客户时值为update
domainType string 领域类型,Customer:客户类型,BehaviourLog:行为类型
domainId string 客户id
old_body object 修改前客户对象
body object 修改后客户对象

注:客户字段说明参照创建客户字段说明

客户合并消息格式

[
    {
        "event_type": "merge",
        "domainType": "Customer",
        "old_bodys": [
            {
                "mergedCustomerId": null,
                "city": null,
                "groupId": null,
                "ageState": null,
                "county": null,
                "utmContent": null,
                "industry": null,
                "intentionality": null,
                "source": "{\"origin\":\"deal_js_sdk\",\"context\":{}}",
                "title": "",
                "searchKeyword": null,
                "platform": null,
                "createdAt": "2018-02-07 10:45:48",
                "province": null,
                "kuickUserId": "5188",
                "appId": "xxxx",
                "company": "",
                "from": null,
                "id": "xxxx",
                "email": "test@kuick.cn",
                "fromContentLink": null,
                "updatedAt": "2018-02-07 10:45:48",
                "fromContentTitle": null,
                "address": null,
                "fromProvince": null,
                "buyedKeyword": null,
                "leadSource": null,
                "sex": 2,
                "fixedPhone": null,
                "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/83308851-fcb0-4d6a-abab-a025f50a638a.png",
                "promoterId": null,
                "utmCampaign": null,
                "getWay": null,
                "phone": "18060000000",
                "grade": null,
                "name": "张三",
                "createWay": 1,
                "utmMedium": null,
                "fromCity": null,
                "status": 1
            },
            {
                "mergedCustomerId": null,
                "city": null,
                "groupId": null,
                "ageState": null,
                "county": null,
                "utmContent": null,
                "industry": null,
                "intentionality": null,
                "source": "{\"origin\":\"deal_js_sdk\",\"context\":{}}",
                "title": "",
                "searchKeyword": null,
                "platform": null,
                "createdAt": "2018-02-07 10:45:48",
                "province": null,
                "kuickUserId": "5188",
                "appId": "xxxx",
                "company": "",
                "from": null,
                "id": "xxxx",
                "email": "test@kuick.cn",
                "fromContentLink": null,
                "updatedAt": "2018-02-07 10:45:48",
                "fromContentTitle": null,
                "address": null,
                "fromProvince": null,
                "buyedKeyword": null,
                "leadSource": null,
                "sex": 2,
                "fixedPhone": null,
                "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/83308851-fcb0-4d6a-abab-a025f50a638a.png",
                "promoterId": null,
                "utmCampaign": null,
                "getWay": null,
                "phone": "18060000000",
                "grade": null,
                "name": "张三",
                "createWay": 1,
                "utmMedium": null,
                "fromCity": null,
                "status": 1
            }
        ],
        "body": {
            "mergedCustomerId": "xxxx,",
            "city": null,
            "groupId": null,
            "ageState": null,
            "county": null,
            "utmContent": null,
            "industry": null,
            "intentionality": null,
            "source": "{\"origin\":\"deal_js_sdk\",\"context\":{}}",
            "title": "",
            "searchKeyword": null,
            "platform": null,
            "createdAt": "2018-02-07 10:45:48",
            "province": null,
            "kuickUserId": "5188",
            "appId": "xxxx",
            "company": "",
            "from": null,
            "id": "xxxx",
            "email": "test@kuick.cn",
            "fromContentLink": null,
            "updatedAt": "2018-02-07 10:45:48",
            "fromContentTitle": null,
            "address": null,
            "fromProvince": null,
            "buyedKeyword": null,
            "leadSource": null,
            "sex": 2,
            "fixedPhone": null,
            "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/83308851-fcb0-4d6a-abab-a025f50a638a.png",
            "promoterId": null,
            "utmCampaign": null,
            "getWay": null,
            "phone": "18060000000",
            "grade": null,
            "name": "张三",
            "createWay": 1,
            "utmMedium": null,
            "fromCity": null,
            "status": 1
        },
        "domainId": "xxxx"
    }
]

字段说明

字段名称 字段类型 字段说明
event_type string 事件类型,合并客户时值为merge
domainType string 领域类型,Customer:客户类型,BehaviourLog:行为类型
domainId string 客户id
old_bodys objectArray 合并前客户对象列表
body object 合并后客户对象

注:客户字段说明参照创建客户字段说明

访客行为消息格式

[
    {
        "event_type": "create",
        "domainType": "BehaviourLog",
        "body": {
            "dealUserId": "xxxx",
            "os": "Windows Server 2008 R2 / 7",
            "dealUserName": "xxxx",
            "clientName": "Chrome",
            "city": "xxxx",
            "ip": "121.69.130.146",
            "description": "xxxx",
            "params": null,
            "clientVersion": "",
            "when": "2018-02-07 11:02:17",
            "content": "{\"web_access_log_id\":\"a6ec2eb9-af76-41f7-8268-5928ada5a890\",\"url\":\"http://beta.1kanban.com/web/product.html\",\"title\":\"xxxx\"}",
            "osVersion": "",
            "province": "xxxx",
            "kuickUserId": "",
            "appId": "xxxx",
            "action": "web_page_view",
            "createdTime": "2018-02-07 11:02:17",
            "location": "xxxx",
            "id": "xxxx",
            "userType": 0,
            "net": "",
            "customer": {
                "city": "",
                "groupId": "xxxx",
                "ageState": -1,
                "county": "",
                "utmContent": null,
                "industry": "",
                "intentionality": 0,
                "source": "{\"origin\":\"weixin_follow\"}",
                "title": "",
                "searchKeyword": "",
                "platform": "weixin",
                "createdAt": "2017-11-15 19:04:50",
                "province": "",
                "kuickUserId": "5188",
                "appId": "xxxx",
                "company": "",
                "from": "xxxx",
                "id": "xxxx",
                "email": "xxxx",
                "fromContentLink": "",
                "updatedAt": "2017-11-15 19:04:51",
                "fromContentTitle": "",
                "address": "",
                "fromProvince": "xxxx",
                "buyedKeyword": null,
                "leadSource": "",
                "sex": 2,
                "fixedPhone": "",
                "headportraitUrl": "http://cdn-img.prod.kuick.cn/user/header/916cacfa-966f-4646-93aa-07d7eda7df32.png",
                "promoterId": "5188",
                "utmCampaign": null,
                "getWay": 0,
                "phone": "xxxx",
                "grade": 0,
                "name": "xxxx",
                "createWay": 3,
                "utmMedium": null,
                "fromCity": "xxxx",
                "status": 1
            }
        },
        "domainId": "xxxx"
    }
]

字段说明

字段名称 字段类型 字段说明
event_type string 事件类型,这里固定为create
domainType string 领域类型,Customer:客户类型,BehaviourLog:行为类型
domainId string 行为记录id
appId string 项目id
kuickUserId string KuickDeal用户id
dealUserId string 访客id
dealUserName string 访客名称
action string 行为类型
params string 行为记录参数
description string 行为描述
when date 行为产生时间
content string 行为内容json,存储行为相关值
clientName string 产生行为客户端名称
clientVersion string 产生行为客户端版本
os string 产生行为操作系统
osVersion string 产生行为操作系统版本
net string 产生行为时网络环境
ip string 产生行为ip地址
location string 产生行为地理位置
province string 产生行为省份
city string 产生行为城市
createdTime date 行为记录创建时间
userType int 行为产生方,0:访客行为,1:客户行为
customer object 客户对象,如果访客有对应客户则该对象不为空,如果访客没有对应客户,则返回结果中不存在该对象

客户行为消息格式

[
    {
        "event_type": "create",
        "domainType": "BehaviourLog",
        "body": {
            "os": "Windows Server 2008 R2 / 7",
            "clientName": "Chrome",
            "ip": "121.69.134.122",
            "description": "没什么需求,注册看看",
            "params": null,
            "clientVersion": "62.0.3202.89",
            "when": "2018-02-07 11:18:28",
            "customerName": "xxxx",
            "content": "{\"customer_id\":\"211a730a-5dd7-40d6-82f0-8e2ae5af5359\"}",
            "osVersion": "7",
            "kuickUserId": "5595",
            "appId": "xxxx",
            "customerId": "xxxx",
            "action": "customer_record",
            "createdTime": "2018-02-07 11:18:28",
            "location": "北京市",
            "id": "xxxx",
            "userType": 1,
            "net": "pc"
        },
        "domainId": "xxxx"
    }
]

字段说明

字段名称 字段类型 字段说明
event_type string 事件类型,这里固定为create
domainType string 领域类型,Customer:客户类型,BehaviourLog:行为类型
domainId string 行为记录id
appId string 项目id
kuickUserId string KuickDeal用户id
customerId string 客户id
customerName string 访客名称
action string 行为类型
params string 行为记录参数
description string 行为描述
when date 行为产生时间
content string 行为内容json,存储行为相关值
clientName string 产生行为客户端名称
clientVersion string 产生行为客户端版本
os string 产生行为操作系统
osVersion string 产生行为操作系统版本
net string 产生行为时网络环境
ip string 产生行为ip地址
location string 产生行为地理位置
province string 产生行为省份
city string 产生行为城市
createdTime date 行为记录创建时间
userType int 行为产生方,0:访客行为,1:客户行为
北京西会科技有限公司©2015-2018 all right reserved,powered by Gitbook该文件修订时间: 2019-08-31 00:11:38

results matching ""

    No results matching ""