聯繫人管理
批量添加或更新聯繫人
URL:
https://email.api.engagelab.cc/v1/marketing/lists/members
HTTP 請求方式
POST
Content-Type
application/json; charset=utf-8
請求 Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | true | Basic base64(api_user:api_key) |
Body 參數
Parameter | Type | Required | Description |
---|---|---|---|
members | array[object] | true | 聯絡人列表,上限個數1000 |
string | true | 郵箱地址 | |
phone | string | false | 電話號碼 |
name | string | false | 暱稱 |
fields | object | false | 聯絡人屬性 |
tags | string[] | false | 標籤名稱列表 |
tag_flag | integer | false | 標籤更新方式,0.覆蓋、1.追加、2.跳過,預設值為1 |
update_existing | boolean | true | 是否更新屬性(如果地址列表存在該地址) |
說明
- 如果某聯繫人 Email 字段和參數 members.email 的值相同,則為更新此聯繫人,反之為添加聯繫人。
- 關於 tag_flag 不同值,所對應的不同的標籤更新方式,見下面示例:
tag_flag | 原tags | 参数tags | 新tags |
---|---|---|---|
0 | [1,2,3] | [] | [] |
0 | [1,2,3] | null,未传 | [1,2,3] |
0 | [1,2,3] | [3,4,5] | [3,4,5] |
1 | [1,2,3] | [] | [1,2,3] |
1 | [1,2,3] | null,未传 | [1,2,3] |
1 | [1,2,3] | [3,4,5] | [1,2,3,4,5] |
2 | [1,2,3] | [] | [1,2,3] |
2 | [1,2,3] | null,未传 | [1,2,3] |
2 | [1,2,3] | [3,4,5] | [1,2,3] |
2 | [] | [3,4,5] | [] |
請求示例
curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ=='
-i https://email.api.engagelab.cc/v1/marketing/lists/members
--data '{"members":[{"email":"xjmfc@126.com","phone":"13681312919","name":"朱锁锁","fields":{"Birthday":"03/30","Age":"12","customField":"我的测试"},"tags":["testTag"]}],"tag_flag":0,"update_existing":true}'
/xiao queren email phone name tag (xitong moren 7ge ziduan)shifou dou zhichi xiaoxie ,qianduan zhanshi shang qufen
響應示例
Response-Success
HttpStatus: 200
{
"created_count": 2,
"created_members": [{
"email": "202205ab233444444444446@qq.com",
"member_id": "6294b0fa490f33c5ee3b5b0c"
},{
"email": "202205ab3331@qq.com",
"member_id": "6294b0fa490f33c5ee3b5b0d"
}],
"updated_count": 2,
"updated_members": [{
"email": "202205ab233444444444447@qq.com",
"member_id": "6294b0fa490f33c5ee3b5b1c"
},{
"email": "202205ab3332@qq.com",
"member_id": "6294b0fa490f33c5ee3b5b1d"
}],
"error_count": 2,
"error_members": [{
"email": "202205ab233444444444446@qq.com",
"message": "..."
},{
"email": "202205ab3331@qq.com",
"message": "..."
}]
}
Response-Error
{
"code": 30000,
"message": "Authentication failed"
}
刪除單個聯繫人
URL
https://email.api.engagelab.cc/v1/marketing/lists/members/{member_id}
HTTP 請求方式
DELETE
Content-Type
application/x-www-form-urlencoded;charset=utf-8
請求 Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | true | Basic base64(api_user:api_key) |
請求示例
curl -X DELETE -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/members/8
響應示例
Response-Success
HttpStatus: 200
{
"count": 1
}
Response-Error
HttpStatus: 401
{
"code": 30000,
"message": "Authentication failed"
}
批量刪除聯繫人
URL
https://email.api.engagelab.cc/v1/marketing/lists/members/delete
HTTP 請求方式
DELETE
Content-Type
application/json; charset=utf-8
請求 Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | true | Basic base64(api_user:api_key) |
Body 參數
Parameter | Type | Required | Description |
---|---|---|---|
condition | object | false | 查詢條件 |
relation | string | true | 條件關係 (and 或 or) |
items | object[] | true | 篩選條件:支援最多10個篩選條件,篩選條件之間僅支援 relation 全為且,或全為或 |
field_name | string | true | field_name為屬性名稱,value 為屬性值; field_name為 tag 時,value = tag name |
op | string | true | 運算符(== , != , > , >= , < , <= , exist , contain , does not contain) |
value | string | true | 當field_name為 tag 時,value = tag name 當field_name為屬性名稱,格式請參考篩選條件 |
說明
- field_name 和op 對應的關係請參考篩選條件)
請求示例
curl -X DELETE -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/members/delete --data '
{
"condition": {
"relation": "or",
"items": [
{
"field_name": "Email",
"op": "contain",
"value": "hotmail.com"
},
{
"field_name": "Phone",
"op": "contain",
"value": "188"
}
]
}
}
'
響應示例
Response-Success
HttpStatus: 200
{
"count": 1
}
Response-Error
HttpStatus: 401
{
"code": 30000,
"message": "Authentication failed"
}
更新單個聯繫人
URL
https://email.api.engagelab.cc/v1/marketing/lists/members/{member_id}
HTTP 請求方式
PUT
Content-Type
application/json; charset=utf-8
請求 Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | true | Basic base64(api_user:api_key) |
Body 參數
Parameter | Type | Required | Description |
---|---|---|---|
phone | string | false | 手機號碼 |
name | string | false | 暱稱 |
fields | object | false | 聯絡人屬性 |
tags | string[] | false | 標籤名稱列表 |
請求示例
curl -X PUT -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i
https://email.api.engagelab.cc/v1/marketing/lists/members/62974a5e490f33c5eee647a2
--data '{"phone":"13681312919","name":"朱锁锁","fields":{"Birthday":"03/30","Age":"12","customField":"我的测试"},"tags":["testTag"]}'
響應說明
Parameter | Type | Description |
---|---|---|
member_id | string | 聯繫人 ID |
list_id | integer | 列表 ID |
user_id | integer | 使用者 ID |
string | 電子郵件地址 | |
phone | string | 手機號碼 |
name | string | 姓名 |
create_time | string | 建立時間(UTC+8) |
update_time | string | 更新訂閱時間(UTC+8) |
unsubscribe_time | string | 取消訂閱時間(UTC+8) |
fields | object | 聯繫人屬性 |
tags | string[] | 標籤 ID 集合 |
tag_names | string[] | 標籤名稱集合 |
響應示例
Response-Success
HttpStatus: 200
{
"count": 1
}
Response-Error
HttpStatus: 200
{
"code": 30036,
"message": "resource not found"
}
聯繫人詳情
URL
https://email.api.engagelab.cc/v1/marketing/lists/members/{member_id}
HTTP 請求方式
GET
Content-Type
application/x-www-form-urlencoded;charset=utf-8
請求 Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | true | Basic base64(api_user:api_key) |
請求示例
curl -X GET -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/members/62974a5e490f33c5eee647a2
響應說明
Parameter | Type | Description |
---|---|---|
member_id | string | 聯絡人 ID |
list_id | integer | 清單 ID |
string | 電子郵件地址 | |
phone | string | 手機號碼 |
name | string | 名字 |
create_time | string | 建立時間(UTC+8) |
update_time | string | 更新訂閱時間(UTC+8) |
unsubscribe_time | string | 取消訂閱時間(UTC+8) |
fields | object | 聯絡人屬性 |
tag_ids | string[] | 標籤 ID 集合 |
tag_names | string[] | 標籤名稱集合 |
Response-Success
HttpStatus: 200
{
"result": {
"member_id": "6565c12a3b4e0d83d3f58ea0",
"list_id": 95964,
"email": "xjmfc@126.com",
"phone": null,
"name": null,
"fields": {
"Birthday": "03/30",
"Age": "12"
},
"tag_ids": [],
"tag_names": [],
"create_time": "2023-11-28T18:30:02+0800",
"update_time": "2023-11-30T16:44:44+0800",
"unsubscribe_time": null
}
}
Response-Error
HttpStatus: 401
{
"code": 30000,
"message": "Authentication failed"
}
聯繫人列表
URL
https://email.api.engagelab.cc/v1/marketing/lists/list_members
HTTP 請求方式
POST
Content-Type
application/json; charset=utf-8
請求 Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | true | Basic base64(api_user:api_key) |
Query 參數
Parameter | Type | Required | Description |
---|---|---|---|
limit | integer | false | 查询个数,取值区间 [1-100],默认为 10 |
offset | integer | false | 查询起始位置, 取值区间 [0-],默认为 0 |
Body 參數
Parameter | Type | Required | Description |
---|---|---|---|
condition | object | false | 查詢條件 |
relation | string | true | 條件關係 (and 或 or) |
items | object[] | true | 篩選條件。支援最多10個篩選條件,篩選條件之間,僅支援 relation 全部為且,或全部為或 |
field_name | string | true | field_name為屬性名稱,value為屬性值; field_name為 tag 時,value=tag name |
op | string | true | 運算符(== , != , > , >= , < , <= , exist , contain , does not contain) |
value | string | true | 當field_name為 tag 時,value=tag name 當field_name為屬性名稱,格式請參考篩選條件 |
说明
- field_name 和op 對應的關係請參考篩選條件)
請求示例
curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/listMembers?offset=0&limit=10 --data '{
"condition": {
"relation": "and",
"items": [
{
"field_name": "Email",
"op": "contain",
"value": "qq.com"
}
]
}
}'
響應說明
Parameter | Type | Description |
---|---|---|
list | array | 列表陣列 |
member_id | string | 聯絡人 ID |
list_id | integer | 列表 ID |
string | 電子郵件地址 | |
phone | string | 手機號碼 |
name | string | 姓名 |
create_time | string | 建立時間(UTC+8) |
update_time | string | 更新訂閱時間(UTC+8) |
unsubscribe_time | string | 訂閱時間(UTC+8) |
fields | object | 聯絡人屬性 |
tag_ids | string[] | 標籤ID集合 |
tag_names | string[] | 標籤名集合 |
total | integer | 記錄總數 |
Response-Success
HttpStatus: 200
{
"result": [
{
"member_id": "6565c12a3b4e0d83d3f58ea0",
"list_id": 95964,
"email": "xjmfc@126.com",
"phone": null,
"name": null,
"fields": {
"Birthday": "03/30",
"Age": "12"
},
"tag_ids": [],
"tag_names": [],
"create_time": "2023-11-28T18:30:02+0800",
"update_time": "2023-11-30T17:00:19+0800",
"unsubscribe_time": null
}
],
"total": 3,
"count": 1
}
Response-Error
HttpStatus: 401
{
"code": 30000,
"message": "Authentication failed"
}