根据邮箱批量导入用户
BatchSyncUserByEmail
:根据邮箱将联系人批量导入 SmartLink,并对已存在联系人进行更新。单次导入上限200个。
POST /api/v3/userinfo/batch_sync_user_by_email
请求参数
了解关于查询参数的更多信息,请参见 查询参数。
属性 | 数据类型 | 备注 | 描述 |
---|---|---|---|
users | []User | 必填 | 批量导入联系人(单次导入上限200个) |
User
属性 | 数据类型 | 备注 | 描述 |
---|---|---|---|
string | 必填 | 邮箱 | |
modify_ts | bigint | 必填 | 最后更新时间戳(以毫秒为单位) |
tags | []string | 选填 | 自定义标签,对用户进行分组,用于用户分层:
|
openid | string | 选填 | 唯一用户 ID(最多20个数字字符) |
subscribe | int | 选填 | 用户订阅状态 1: 订阅,0: 取消订阅,-1: 未知 |
location | string | 选填 | 三位国家编码,详见 国家或地区信息表 对应的 number_code 区域参数为未知或空值时,不会覆盖原来数据。 |
language | string | 选填 | 语言编码,详见 语言信息表 对应的 language_code 语言参数为未知或空值时,不会覆盖原来数据。 |
attributes | object | 选填 | 自定义用户属性。支持更新联系人的其他属性,例如性别、生日等。 用于用户分层,进而创建更个性化的活动:
|
preferences | []string | 选填 | 用于标识联系人的订阅偏好,能够按兴趣和偏好等对订阅者进行分类。 用于用户分层,将邮件定向发送给具有特定偏好的用户:
|
update_strategy | int | 选填 | 是否更新 subscribe 字段,详见 更新策略。 |
请求示例
curl --request POST "https://openapi.smartlink.intlgame.com/api/v3/userinfo/batch_sync_user_by_email?gameid=${GAME_ID}&seq=${YOUR_RANDOM_STRING}&sig=${SIGNATURE}&ts=${TS}" \
--header 'Content-Type: application/json' \
--data-raw '{
"users":[
{
"email": "example@smartlink.intlgame.com",
"modify_ts": 1691225447577,
"tags": [
"tag1","tag2"
],
"openid": "5450588341569",
"subscribe": 1,
"location": "004",
"language": "en",
"attributes": {
"nickname": "tang",
"level": "10",
"birthday":"1990-05-09 00:00:00+08:00",
"prop":["option1","option2"]
},
"preferences": [
"option1","option2"
]
},
{
"email": "example1@smartlink.intlgame.com",
"modify_ts": 1691225447577,
"tags": [
"tag3","tag4"
],
"openid": "5450588341579",
"subscribe": 1,
"location": "004",
"language": "en",
"attributes": {
"nickname": "tang2",
"level": "19",
"birthday":"1990-05-09 00:00:00+08:00",
"prop":["option1","option2"]
},
"preferences": [
"option1","option2"
]
}
]
}'
响应参数
属性 | 数据类型 | 描述 |
---|---|---|
code | int | 返回码 |
msg | string | 返回消息 |
data | []ErrorUsers | 错误信息数组,若请求参数有多个错误通过该数组聚合返回所有错误 |
ErrorUsers
属性 | 数据类型 | 描述 |
---|---|---|
req_index | int | 请求参数中的数组索引 |
string | 邮箱 | |
errors | []Error | 错误信息数组 |
Error
属性 | 数据类型 | 描述 |
---|---|---|
code | int | 返回码 |
msg | string | 返回消息 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"error_users": [
{
"req_index": 0,
"email": "example@smartlink.intlgame.com",
"errors": [
{
"code": 17001,
"msg": "tag is not exist :tag1"
},
{
"code": 17001,
"msg": "tag is not exist :tag2"
}
]
}
]
},
"seq": "{YOUR_RANDOM_STRING}"
}