Set Contact Information API

Last updated:2023-11-13
Expand all
Set Contact Information API

In the Operation Growth platform, contact information can be used as a reach target for channel-based reach, such as App notifications, SMS, and email.
When a user's contact information changes, you can use this API to update the user's Contact Information under Reach Channel -> Contact Label.
Setting contact information must be based on CUID, and the key (contact label) corresponding to the contact information must already exist in the channel management center of the Operation Growth platform.


Request Method

PUT

Request URL

PUT https://growth.jiguang.cn/smartop/api/v1/user/channel/batch
          PUT https://growth.jiguang.cn/smartop/api/v1/user/channel/batch

        
This code block is shown in the floating window

QPS Limit

QPS <= 100

Request Headers

> Content-Type: application/json > Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==
          > Content-Type: application/json
> Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==

        
This code block is shown in the floating window

Request Body Parameters

The API supports batch setting for multiple CUID users. The number of request records must be <= 100.

In real business scenarios, do not include comments. The comments in the following example are only to help developers understand parameter meanings.

[{ "cuid": 10362819, // User identity ID "channels": [{ "id": 210, // Channel ID "channelValues": { "默认联系": "15088888888", // Contact label: contact information "自定义联系": "123@qq.com" } }, { "id": 2210, "channelValues": { "默认联系": "15099999999", "自定义联系1": "123@qq.com" } }] }, { "cuid": 103629, "channels": [{ "id": 219, "channelValues": { "默认联系": "15088888888", "自定义联系": "123@qq.com" } }] }]
          [{
 "cuid": 10362819, // User identity ID
 "channels": [{
 "id": 210, // Channel ID
 "channelValues": {
 "默认联系": "15088888888", // Contact label: contact information
 "自定义联系": "123@qq.com"            
 }
 }, {
 "id": 2210,
 "channelValues": {
 "默认联系": "15099999999",
 "自定义联系1": "123@qq.com"            
 }
 }]
}, {
 "cuid": 103629,
 "channels": [{
 "id": 219,
 "channelValues": {
 "默认联系": "15088888888",
 "自定义联系": "123@qq.com"            
 }
 }]
}]

        
This code block is shown in the floating window
Field Type Required Description
cuid Long Yes Unique user ID of the Operation Growth platform
channels Array Yes Channel information list
id Long Yes Channel ID
channelValues JSON Object Yes Key-value pairs for each category of channel information. The key is the contact label name, and the value is the contact information.
  • Set the user's Contact Information for the Contact Label under the specified Channel ID.
  • The initial contact label name is Default Contact. To set a custom name, first add a contact label in the platform UI.
  • Setting values for multiple Contact Labels of multiple users at the same time is supported.
  • When setting the Contact Label for App Notification, the value must be the user's Registration ID.
  • When setting the Contact Label for SMS, the value must be an 11-digit number in mobile phone number format.

Response Parameters

  • N/A. HTTP code 200 indicates that the API response succeeded.
Field Type Required Description
code Int Yes Whether the API call succeeded. 0 indicates success, and other values indicate an error. 4000 indicates multiple errors, which must be viewed in data.
msg String Yes API call result description, with a text explanation of the error code.
data Array No Error code list
code Int Yes Error code for setting the Contact Label
msg String Yes Text description of the error code for setting the Contact Label

Successful Response

{ "code": 0, "msg": "ok" }
          {
 "code": 0,
 "msg": "ok"
}

        
This code block is shown in the floating window

Failed Response

Single error response:

{ "code": 4107, "msg": "通道信息保存异常![默认联系1] 联系标签不存在" }
          {
 "code": 4107,
 "msg": "通道信息保存异常![默认联系1] 联系标签不存在"
}

        
This code block is shown in the floating window

Multiple error response:

{ "code": 4000, "msg": "请求有多个错误,请在data中查看错误码列表", "data": [ { "code": 4107, "msg": "通道信息保存异常![默认联系1] 联系标签不存在" }, { "code": 4107, "msg": "通道信息保存异常![1234567] CUID不存在" } ] }
          {
 "code": 4000,
 "msg": "请求有多个错误,请在data中查看错误码列表",
 "data": [
 {
 "code": 4107,
 "msg": "通道信息保存异常![默认联系1] 联系标签不存在"
 },
 {
 "code": 4107,
 "msg": "通道信息保存异常![1234567] CUID不存在"
 }
 ]
}

        
This code block is shown in the floating window

Error Codes

Error Code Description Solution
40011 Number of CUID array items exceeds the limit Keep the number of CUID array items between 1 and 100.
40002 Invalid business parameter Handle according to the msg prompt.
4000 Request has multiple errors View the error code list in data.
4107 Channel information save exception, such as CUID does not exist, contact label does not exist, channel ID does not exist, invalid jg_registration_id, or invalid SMS channel value Handle according to the msg prompt.
Was this document helpful?

Copyright 2011-2026, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 Shenzhen Hexun Huagu Information Technology Co., Ltd.

Open in Docs Center