# 联系人合并事件

>  使用此推送需前往PC端管理后台配置推送数据地址链接，配置该对接后，联系人合并时，都将对事件类型和对应联系人信息进行接口回调，用于同步尘锋系统和三方系统中联系人信息
> 对接此事件请先阅读：开发指南->接入指南，文档中的回调“回调配置”模块；

**请求参数（未加密）**

| 请求参数名               | 类型              | 说明                                                                                                                                                                                                                                    |
| ------------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data                     | `Object`          | 消息体                                                                                                                                                                                                                                  |
| data.id                  | `String`          | 事件id                                                                                                                                                                                                                                  |
| data.event               | `String`          | 事件主类型（固定：CRM_MERGE）                                                                                                                                                                                                           |
| data.action              | `String`          | 事件子类型（CRM_CONTACT_MERGED）                                                                                                                                                                                                        |
| data.body                | `Object`          | 数据内容                                                                                                                                                                                                                                |
| data.body.id             | `String`          | ID                                                                                                                                                                                                                                      |
| data.body.mainID         | `String`          | 合并到的主数据id                                                                                                                                                                                                                        |
| data.body.account        | `String`          | 租户ID                                                                                                                                                                                                                                  |
| data.body.uid            | `String`          | 操作人ID                                                                                                                                                                                                                                |
| data.body.actionOrigin   | `String`          | 操作来源  （ normal-页面操作、tableImport-导入表格、sop-操作、autoByFriend-好友自动行为、wxGetContact-网销获客、openAPI-openAPI、cusgroup-人群分组、syncTagsByFriend-好友标签双向同步、autoRecycled-自动回收、autoAssignment-自动分配） |
| data.body.mergedIDs      | `String[]`        | 源联系人ID                                                                                                                                                                                                                              |
| data.body.triggerTs      | `Int`             | 触发时间戳（页面操作或系统自动更新的时间）                                                                                                                                                                                              |
| data.body.mergedContacts | `ContactDetail[]` | 被合并联系人信息                                                                                                                                                                                                                        |
| data.body.changed        | `ContactDetail`   | 变更后的信息，仅仅包含变更的信息字段（针对主id的信息变更）                                                                                                                                                                              |
| data.body.old            | `ContactDetail`   | 原信息                                                                                                                                                                                                                                  |

**联系人信息详情对象-ContactDetail**

| 请求参数名         | 类型       | 说明                                            |
| ------------------ | ---------- | ----------------------------------------------- |
| remark             | `String`   | 备注                                            |
| gender             | `String`   | 性别 0-未知 1-男性 2-女性                       |
| birthday           | `String`   | 生日                                            |
| email              | `String`   | email                                           |
| age                | `Int`      | 年龄                                            |
| national           | `String`   | 国籍                                            |
| position           | `String`   | 职位                                            |
| provCity           | `String`   | 省市区（县）                                    |
| address            | `String`   | 地址                                            |
| coordinate         | `float[]`  | 经纬度                                          |
| qq                 | `String`   | qq                                              |
| nationality        | `String`   | 国籍                                            |
| education          | `String`   | 教育                                            |
| idCard             | `String`   | 身份证                                          |
| weChat             | `String`   | 微信                                            |
| major              | `String`   | 专业                                            |
| categoryID         | `String`   | 联系人类型id                                    |
| avatar             | `String`   | 外部联系人头像                                  |
| mobiles            | `String[]` | 电话号码                                        |
| unionID            | `String`   | unionID                                         |
| externalUserID     | `String`   | 好友外部联系人id                                |
| tags               | `String[]` | 企业标签id集合                                  |
| ruleTags           | `String[]` | 规则标签id集合                                  |
| bizTags            | `String[]` | 联系人标签id集合                                |
| sourceCode         | `String`   | 来源id                                          |
| description        | `String`   | 描述                                            |
| mobileList         | `Object[]` | 手机号信息                                      |
| mobileList.tel     | `String`   | 手机号                                          |
| mobileList.type    | `String`   | 类型                                            |
| mobileList.display | `String`   | 显示                                            |
| customFields       | `Object[]` | 自定义字段 仅变更部分, 非全量; 置空 value 为 "" |
| customFields.id    | `String`   | 字段id                                          |
| customFields.type  | `String`   | 类型                                            |
| customFields.value | `String`   | 值                                              |


**请求参数示例**
`json` - Request-Example-加密:

```json
//明文信息推送
{
    "id": "d7ed8618-6180-4ded-a5a5-a315369e6b1e",
    "event": "CRM_MERGE",
    "action": "CRM_CONTACT_MERGED",
    "body": {
        "id": "eb2198d0-04dd-11ee-bf9b-c64788aed849",
        "mainID": "eb2198d0-04dd-11ee-bf9b-c64788aed849",
        "account": "W00000000082",
        "actionOrigin": "",
        "uid": "34",
        "mergedIDs": [
            "2df106aa-7057-11ed-a049-a2eb63fbe44a"
        ],
        "mergedContacts": [
            {
                "remark": "好",
                "gender": 0,
                "birthday": "",
                "email": "",
                "age": 0,
                "national": "",
                "position": "",
                "provCity": 0,
                "address": "",
                "coordinate": [
                    0,
                    0
                ],
                "qq": "",
                "nationality": "",
                "education": "",
                "idCard": "",
                "weChat": "",
                "source": "",
                "major": "",
                "categoryID": "00000000-0000-0000-0000-000000000000",
                "avatar": "",
                "mobiles": [],
                "unionID": "",
                "externalUserID": "",
                "tags": [],
                "ruleTags": [],
                "bizTags": [],
                "sourceCode": "",
                "description": "",
                "mobileList": [],
                "customFields": [
                    {
                        "id": "field10",
                        "type": "text",
                        "value": "\"\""
                    },
                    {
                        "id": "field34",
                        "type": "radio",
                        "value": "\"\""
                    },
                    {
                        "id": "field35",
                        "type": "datetime",
                        "value": "\"\""
                    },
                    {
                        "id": "field36",
                        "type": "date",
                        "value": "\"\""
                    }
                ]
            }
        ],
        "changed": {
            "customFields": [
                {
                    "id": "field10",
                    "type": "text",
                    "value": "\"\""
                },
                {
                    "id": "field34",
                    "type": "radio",
                    "value": "\"\""
                },
                {
                    "id": "field35",
                    "type": "datetime",
                    "value": "\"\""
                },
                {
                    "id": "field36",
                    "type": "date",
                    "value": "\"\""
                }
            ]
        },
        "old": {
            "remark": "eaasdadasd",
            "gender": 0,
            "birthday": "",
            "email": "",
            "age": 0,
            "national": "",
            "position": "",
            "provCity": 0,
            "address": "",
            "coordinate": [
                0,
                0
            ],
            "qq": "",
            "nationality": "",
            "education": "",
            "idCard": "",
            "weChat": "",
            "source": "",
            "major": "",
            "categoryID": "00000000-0000-0000-0000-000000000000",
            "avatar": "",
            "mobiles": [
                "13299932123"
            ],
            "unionID": "",
            "externalUserID": "",
            "tags": [],
            "ruleTags": [],
            "bizTags": [],
            "sourceCode": "00101f",
            "description": "",
            "mobileList": [
                {
                    "tel": "13299932123",
                    "type": "mobile",
                    "display": "手机"
                }
            ],
            "customFields": []
        },
        "triggerTs": 1686107367
    }
}

//信息加密推送
{
	"id": "4c6421ea-f503-4a89-ba5b-7c9524cf596f",
	"event": "CRM_MERGE",
	"action": "CRM_CONTACT_MERGED",
	"body": {
		"encrypt": "XOKphmyMEcuW94gYtL/5Nj4ueFcfjaEFecC507QGzXbnDmavLp7I+s7K5BI4Qjt+Ayy/mNbw9bUE2x0HkSWm9h57VKJc9VLBghTjALWJcJduBDC7L6doORsZdaNlfVJU6DJ0VLyd1NojW9PfrzS01eQ7GW/dgaO3tkXQP2AOrGTn3Ca8haZQiwEJDYN/NUjW1/9T+gIcBu8LbmZGyokwrOD+ZGy7uky37yq8w8SGpis1WR2pIlZUOo+QdmWnMY1kJ9bHelH9h3ERemmNRIh/oMZp7QvFaNl/iCgUVAkh14tOV0nniE9Ld29GxyIEFz0nxD5+s4AG4cvq+xl+FXhu0A==",
		"msgSignature": "d64cc4a02b22b725a6b50a9843ebf9c0fd7ca70f",
		"timeStamp": "1661233174",
		"nonce": "9ZvYhI4aFmR7wUNl"
	}
}
```

**成功响应**

| 响应参数名 | 类型     | 说明                         |
| ---------- | -------- | ---------------------------- |
| code       | `Int`    | 响应码:状态码 0 失败，1 成功 |
| msg        | `String` | 响应提示                     |

**成功响应示例**

```json
 {
    "code": 1,
    "msg": "成功"
}
```

**错误响应示例**

```json
 {
    "code": 0,
    "msg": "处理失败"
}
```

