logo

Retrieve Customer List

This interface is used to retrieve information for multiple customers at once. This interface can retrieve up to 10,000 pieces of data. If you need to retrieve more data, please use the Customer Export Interface.

Request Method

GET /customers

Request Parameters (Query String)

Parameter NameTypeRequiredDescriptionRestrictions
filter_idIntegerNoCustomer filter ID
queryStringNoKeyword for customer search
pageIntegerNoPage number, starting from 1, default is 1
page_sizeIntegerNoNumber of items per page, default is 20, maximum is 100

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
metaObjectPagination information, see Common Data
customersArrayCustomer list, see Customer Data for each customer's description
wechatArrayWeChat channel information, see below
weiboArrayWeibo channel information, see below

wechat

Attribute NameTypeDescription
idStringThe app_id of the first WeChat channel corresponding to the customer's company
nameStringThe name of the first WeChat channel corresponding to the customer's company

weibo

Attribute NameTypeDescription
idStringThe app_id of the first Weibo channel corresponding to the customer's company
nameStringThe name of the first Weibo channel corresponding to the customer's company

Example

curl https://demo.udesk.cn/open_api_v1/customers?page=1&page_size=10&email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "meta": {
        "current_page": 1,
        "total_pages": 1,
        "total_count": 1
    },
    "wechat": [
        {
            "id":   "wxee100100100abc",
            "name": "customer 1"
        },
        {
            "id":   "wxee100100100qwe",
            "name": "customer 2"
        }
    ],
    "weibo": [
        {
            "id":   "wb1001001001",
            "name": "customer 1"
        },
        {
            "id":   "wb1001001002",
            "name": "customer 2"
        }
    ],
    "customers": [
        {
            "id": 1,
            "nick_name": "Test User",
            "level": "normal",
            "description": null,
            "owner_id": 1,
            "owner_group_id": 1,
            "custom_fields": {
                "SelectField_1": ["0"],
                "SelectField_2": ["0"]
            },
            "open_api_token": null,
            "organization_id": null,
            "is_blocked": false,
            "web_token": "dcc79435-e9e2-436a-9cdf-c9f13f728923",
            "sdk_token": "b0bf5c37-ebdd-4539-a961-7941aca02e4c",
            "tags": [],
            "rich_tags": [
                {
                    "id": 1,
                    "name": "Rich text label 1",
                    "color": "#70BE72",
                    "company_id": 1
                }
            ],
            "first_contact_at": null,
            "last_contact_at": null,
            "first_contact_at_via_phone": null,
            "last_contact_at_via_phone": null,
            "first_contact_at_via_im": null,
            "last_contact_at_via_im": null,
            "email": "customer@sample.com",
            "other_emails": [],
            "cellphones": [
                {
                  "id": 1,
                  "content": "13000000001"
                }
            ],
            "platform": "Manual entry",
            "source_channel": "Manual creation",
            "weixins": [
                {
                    "appid": "wxf54489a1azz51885",
                    "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                    "unionid": ""
                }
            ],
            "weixin_minis": [
                {
                    "appid": "wxc7279f8eefd70a4a",
                    "openid": "oa3cT0mano9wVhIpkp3drqy9yDuw",
                    "unionid": ""
                }
            ],
            "weixin_works": [
                {
                    "agentid": "1009117",
                    "corpid": "wxc727955fe6025ed4",
                    "userid": "LS004308",
                    "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DI"
                }
            ]
        }
    ]
}

Retrieve Customer Details

This interface is used to retrieve information for specified customers.

Request Method

GET /customers/get_customer

Request Parameters (Query String)

Parameter NameTypeRequiredDescriptionRestrictions
typeStringYesCondition type, see below
contentStringYesCondition content

Condition Type

ValueMeaning of content
idCustomer ID
emailCustomer email
cellphoneCustomer phone number
tokenCustomer external unique identifier
weixin_open_idCustomer WeChat openid
weixin_mini_openidCustomer WeChat Mini Program openid
weixin_work_identifierCustomer Enterprise WeChat unique identifier, e.g., cropid:wxc727955fe6025ed4,agentid:1009117,userid:LS004308
weibo_idCustomer Weibo openid
sdk_tokenCustomer SDK identifier
web_tokenCustomer web identifier

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
customerObjectCustomer information, see Customer Data

Example

curl https://demo.udesk.cn/open_api_v1/customers/get_customer?type=email&content=customer@sample.com&email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "customer": {
        "id": 1,
        "nick_name": "Test User",
        "level": "normal",
        "description": null,
        "owner_id": 1,
        "owner_group_id": 1,
        "custom_fields": {
            "SelectField_1": ["0"],
            "SelectField_2": ["0"]
        },
        "open_api_token": null,
        "organization_id": null,
        "is_blocked": false,
        "web_token": "dcc79435-e9e2-436a-9cdf-c9f13f728923",
        "sdk_token": "b0bf5c37-ebdd-4539-a961-7941aca02e4c",
        "tags": [],
        "rich_tags": [
                {
                    "id": 1,
                    "name": "Rich text label 1",
                    "color": "#70BE72",
                    "company_id": 1
                }
            ],
        "first_contact_at": null,
        "last_contact_at": null,
        "first_contact_at_via_phone": null,
        "last_contact_at_via_phone": null,
        "first_contact_at_via_im": null,
        "last_contact_at_via_im": null,
        "email": "customer@sample.com",
        "other_emails": [],
        "cellphones": [
            {
              "id": 1,
              "content": "13000000001"
            }
        ],
        "platform": "Manual entry",
        "source_channel": "Manual creation",
        "weixins": [
            {
                "appid": "wxf54489a1azz51885",
                "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                "unionid": ""
            }
        ],
        "weixin_minis": [
            {
                "appid": "wxc7279f8eefd70a4a",
                "openid": "oa3cT0mano9wVhIpkp3drqy9yDuw",
                "unionid": ""
            }
        ],
        "weixin_works": [
            {
                "agentid": "1009117",
                "corpid": "wxc727955fe6025ed4",
                "userid": "LS004308",
                "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DI"
            }
        ],
        "weixin_kfs": [
            {
                "external_userid": "wmtmN_BgAAj3Sj7j4hv9tD29NoiCZt9A",
                "open_kfid": "wktmN_BgAAuVqNn__Ls5I8dClfOBbAvw",
                "unionid": "o_7Qg6ROh71walfIHr7xtXr-VWDo"
            }
        ]
    }
}

Create Customer

This interface is used to create a customer.

Request Method

POST /customers

Request Parameters (Request Body)

Parameter NameTypeRequiredDescriptionConstraints
customerObjectYesCustomer information, see below
other_emailsArrayNoList of other email addresses, see example
tagsStringNoList of tags, separated by commas

customer

Parameter NameTypeRequiredDescriptionConstraints
emailStringNoPrimary email addressMaximum length 255 characters
open_api_tokenStringNoExternal unique identifierMaximum length 255 characters
nick_nameStringYesNameMaximum length 255 characters
organization_idIntegerNoCustomer company ID
descriptionStringNoDescriptionMaximum length 255 characters
owner_idIntegerNoResponsible customer service ID
owner_group_idIntegerNoResponsible customer service group ID
levelStringNoLevel, default is 'normal', see Customer Data
is_blockedBooleanNoWhether to add to the blacklist, default is falseOptions are false, true
cellphonesArrayNoList of phones, see below
weixinsArrayNoList of WeChat accounts, see below
weixin_minisArrayNoList of WeChat Mini Programs, see below
weixin_worksArrayNoList of Enterprise WeChat accounts, see below
custom_fieldsObjectNoCustom fields"Field Type Name"_"Field Unique ID" See
web_tokenStringNoCustomer web tokenMaximum length 255 characters

Note:

  • The customer service ID (owner_id) is associated with the customer service group ID (owner_group_id). When using the parameter owner_id, the matching owner_group_id must be added.

web_token

  • Only letters, numbers, @ symbol, period, hyphen, and underscore are supported. Special characters other than these are not allowed. It is recommended to use email or phone numbers.
  • If you modify a user's web_token, you must also modify the web_token when using IM User Identification, otherwise the original user cannot be recognized.

cellphones

Each element is an array: [phone_id, phone_text] When adding a new phone, phone_id is null, see example.

weixins

Each element is an object with the following attributes:

Parameter NameTypeRequiredDescriptionConstraints
actionStringYesAction to performOptions: "new": Add, "delete": Delete
appidStringYesWeChat application ID
openidStringYesCustomer's WeChat openid
unionidStringNoCustomer's WeChat unionid

Note:

  • appid + openid is unique, an error will occur if it already exists;
  • Entries with empty appid and openid will be ignored, as will entries with incorrect action values;
  • The "delete" operation can only appear when updating customers, it will be ignored if it appears when creating new customers;
  • When updating customers, the "delete" operation is performed first, followed by the "new" operation.
  • WeChat must be bound to the corresponding customer service system in advance. Operation location: Customer Service System->Management Center->Channel Management->WeChat

weixin_minis

Each element is an object containing the following attributes:

Parameter NameTypeRequiredDescriptionRestrictions
actionStringYesAction to be performedOptional values: "new": Add, "delete": Delete
appidStringYesWeChat Mini Program ID
openidStringYesCustomer's WeChat Mini Program OpenID
unionidStringNoCustomer's WeChat Mini Program UnionID

Notes:

  • appid + openid is unique, and an error will be reported if it already exists;
  • Entries with empty appid, openid will be ignored, as well as those with incorrect action values;
  • The "delete" operation can only appear when updating a customer and will be ignored when creating a new customer;
  • When updating a customer, the "delete" operation is performed first, followed by the "new" operation.
  • WeChat Mini Programs must be bound to the corresponding customer service system in advance. Location: Customer Service System -> Management Center -> Channel Management -> Mini Program

weixin_works

Each element is an object containing the following attributes:

Parameter NameTypeRequiredDescriptionRestrictions
actionStringYesAction to be performedOptional values: "new": Add, "delete": Delete
agentidStringYesEnterprise WeChat Application ID
useridStringYesUser ID in Enterprise WeChat
corpidStringYesEnterprise ID in Enterprise WeChat
open_useridStringNoUser ID for third-party identification in Enterprise WeChat

Notes:

  • Enterprise WeChat must be bound to the corresponding customer service system in advance. Location: Customer Service System -> Management Center -> Channel Management -> Enterprise WeChat

weixin_kfs

Each element is an object containing the following attributes:

Parameter NameTypeRequiredDescriptionRestrictions
external_useridStringNoWeChat Customer Service external_userid
open_kfidStringNoWeChat Customer Service open_kfid
unionidStringNoWeChat Customer Service unionid

Each element is an object containing the following attributes:

Parameter NameTypeRequiredDescriptionRestrictions
actionStringYesAction to be performedOptional values: "new": Add, "delete": Delete
agentidStringYesEnterprise WeChat Application ID
useridStringYesUser ID in Enterprise WeChat
corpidStringYesEnterprise ID in Enterprise WeChat
open_useridStringNoUser ID for third-party identification in Enterprise WeChat

Notes:

  • corpid + agentid + userid is unique, and an error will be reported if it already exists;
  • Entries with empty corpid, agentid, userid will be ignored, as well as those with incorrect action values;
  • The "delete" operation can only appear when updating a customer and will be ignored when creating a new customer;
  • When updating a customer, the "delete" operation is performed first, followed by the "new" operation.

Response Data

The response data is the same as the Get Customer Details API.

Example

curl https://demo.udesk.cn/open_api_v1/customers?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2
 \
-X POST \
-H 'content-type: application/json' \
-d '
{
    "customer": {
        "email": "customer2@sample.com",
        "nick_name": "demo customer 2",
        "owner_id": 1,
        "owner_group_id": 1,
        "level": "vip",
        "is_blocked": false,
        "cellphones": [
            [null, "13100000002"],
            [null, "13200000002"]
        ],
        "custom_fields": {
            "TextField_1": "Plain text content",
            "TextField_2": "Multiline text content 1\r\nMultiline text content 2",
            "TextField_3": "2016-08-11",
            "TextField_4": "14:44:36",
            "TextField_5": "2017-05-03 14:44",
            "TextField_6": "https://www.sample.com",
            "TextField_7": "13",
            "TextField_8": "13.33",
            "SelectField_1": ["0"],
            "SelectField_2": ["0"],
            "SelectField_3": ["0","3"]
        },
        "weixins": [
            {
                "action": "new",
                "appid": "wxf54489a1azz51885",
                "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                "unionid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
            }
        ],
        "weixin_minis": [
            {
                "action": "new",
                "appid": "wxc7279f8eefd70a4a",
                "openid": "oa3cT0mano9wVhIpkp3drqy9yDuw",
                "unionid": "sadgsathGdfsgBfhkfhgddfxzfAs"
            }
        ],
        "weixin_works": [
            {
                "action": "new",
                "agentid": "1009117",
                "corpid": "wxc727955fe6025ed4",
                "userid": "LS004308",
                "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DI"
            }
        ]
    },
    "other_emails": [
        [null, "customer2@sina.com"],
        [null, "customer2@qq.com"]
    ],
    "tags": "tag1,tag2"
}'

Response

{
    "code": 1000,
    "customer": {
        "id": 1,
        "nick_name": "Test User",
        "level": "normal",
        "description": null,
        "owner_id": 1,
        "owner_group_id": 1,
        "custom_fields": {
            "TextField_1": "Plain text content",
            "TextField_2": "Multiline text content 1\r\nMultiline text content 2",
            "TextField_3": "2016-08-11",
            "TextField_4": "14:44:36",
            "TextField_5": "2017-05-03 14:44",
            "TextField_6": "https://www.sample.com",
            "TextField_7": "13",
            "TextField_8": "13.33",
            "SelectField_1": ["0"],
            "SelectField_2": ["0"],
            "SelectField_3": ["0","3"]
        },
        "open_api_token": null,
        "organization_id": null,
        "is_blocked": false,
        "tags": [
            {
                "id": 1,
                "name": "tag1",
                "company_id": 1
            },
            {
                "id": 1,
                "name": "tag2",
                "company_id": 1
            }
        ],
        "rich_tags": [
                {
                    "id": 1,
                    "name": "Rich text label 1",
                    "color": "#70BE72",
                    "company_id": 1
                },
                {
                    "id": 2,
                    "name": "Rich text label 2",
                    "color": "#70BE73",
                    "company_id": 1
                }
            ],
        "email": "customer@sample.com",
        "other_emails": [
            [3,"customer2@sina.com"],
            [4,"customer2@qq.com"]
        ],
        "cellphones": [
            {
                "id": 3,
                "content": "13100000002"
            },
            {
                "id": 4,
                "content": "13200000002"
            }
        ],
        "platform": "Manual entry",
        "source_channel": "Manual creation",
        "weixins": [
            {
                "appid": "wxf54489a1azz51885",
                "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                "unionid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
            }
        ],
        "weixin_minis": [
            {
                "appid": "wxc7279f8eefd70a4a",
                "openid": "asdgasda0mano9hIpkp3drqy9yDuw",
                "unionid": "sdagkjalkiairojhjnchfakhajKJa"
            }
        ],
        "weixin_works": [
            {
                "agentid": "1009117",
                "corpid": "wxc727955fe6025ed4",
                "userid": "LS004308",
                "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DI"
            }
        ]
    }
}

Update Customer

This interface is used to modify customer information.

Request Method

PUT /customers/update_customer

Request Parameters (Query String)

Parameter NameRequiredDescription
typeYesCondition Type
contentYesCondition Content
For more details, see the Get Customer Details API.

Request Parameters (Request Body)

The same as the Create Customer Interface.

Response Data

The same as the Get Customer Details API.

Example

curl https://demo.udesk.cn/open_api_v1/customers/update_customer?type=email&content=customer@sample.com&email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X PUT \
-H 'content-type: application/json' \
-d '
{
    "customer": {
        "level": "normal",
        "custom_fields": {
            "TextField_1": "Plain text content",
            "TextField_2": "Multiline text content 1\r\nMultiline text content 2",
            "TextField_3": "2016-08-11",
            "TextField_4": "14:44:36",
            "TextField_5": "2017-05-03 14:44",
            "TextField_6": "https://www.sample.com",
            "TextField_7": "13",
            "TextField_8": "13.33",
            "SelectField_1": ["0"],
            "SelectField_2": ["0"],
            "SelectField_3": ["0","3"]
        },
        "web_token": "dcc79435-e9e2-436a-9cdf-c9f13f728923",
        "sdk_token": "b0bf5c37-ebdd-4539-a961-7941aca02e4c",
        "weixins": [
            {
                "action": "new",
                "appid": "wxf54489a1azz51885",
                "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                "unionid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
            },
            {
                "action": "delete",
                "appid": "wxf54489a1azz51885",
                "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
            }
        ],
        "weixin_minis": [
            {
                "action": "new",
                "appid": "wxc7279f8eefd70a4a",
                "openid": "oa3cT0mano9wVhIpkp3drqy9yDuw",
                "unionid": "sadgsathGdfsgBfhkfhgddfxzfAs"
            },
            {
                "action": "delete",
                "appid": "wxc7279f8eefd70a4a",
                "openid": "asdgasda0mano9hIpkp3drqy9yDuw"
            }
        ],
        "weixin_works": [
            {
                "action": "new",
                "agentid": "1009117",
                "corpid": "wxc727955fe6025ed4",
                "userid": "LS004308",
                "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DI"
            },
            {
                "action": "delete",
                "agentid": "1009118",
                "corpid": "wxc727955fe6025ed5",
                "userid": "LS004309",
                "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DD"
            }
        ]
    },
    "other_emails": [
        [3, "customer2@sina1.com"]
    ]
}'

Response

{
    "code": 1000,
    "customer": {
        "id": 1,
        "nick_name": "Test User",
        "level": "normal",
        "description": null,
        "owner_id": 1,
        "owner_group_id": 1,
        "first_contact_at": null,
        "last_contact_at": null,
        "first_contact_at_via_phone": null,
        "last_contact_at_via_phone": null,
        "first_contact_at_via_im": null,
        "last_contact_at_via_im": null,
        "custom_fields": {
            "TextField_1": "Plain text content",
            "TextField_2": "Multiline text content 1\r\nMultiline text content 2",
            "TextField_3": "2016-08-11",
            "TextField_4": "14:44:36",
            "TextField_5": "2017-05-03 14:44",
            "TextField_6": "https://www.sample.com",
            "TextField_7": "13",
            "TextField_8": "13.33",
            "SelectField_1": ["0"],
            "SelectField_2": ["0"],
            "SelectField_3": ["0","3"]
        },
        "open_api_token": null,
        "organization_id": null,
        "is_blocked": false,
        "web_token": "dcc79435-e9e2-436a-9cdf-c9f13f728923",
        "sdk_token": "b0bf5c37-ebdd-4539-a961-7941aca02e4c",
        "tags": [
            {
                "id": 1,
                "name": "tag1",
                "company_id": 1
            },
            {
                "id": 1,
                "name": "tag2",
                "company_id": 1
            }
        ],
        "rich_tags": [
                {
                    "id": 1,
                    "name": "Rich text label 1",
                    "color": "#70BE72",
                    "company_id": 1
                },
                {
                    "id": 2,
                    "name": "Rich text label 2",
                    "color": "#70BE73",
                    "company_id": 1
                }
            ],
        "email": "customer@sample.com",
        "other_emails": [
            [3,"customer2@sina1.com"]
        ],
        "cellphones": [
            {
                "id": 3,
                "content": "13100000002"
            },
            {
                "id": 4,
                "content": "13200000002"
            }
        ],
        "platform": "Manual entry",
        "source_channel": "Manual creation",
        "weixins": [
            {
                "appid": "wxf54489a1azz51885",
                "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                "unionid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
            }
        ],
        "weixin_minis": [
            {
                "appid": "wxc7279f8eefd70a4a",
                "openid": "oa3cT0mano9wVhIpkp3drqy9yDuw"
            }
        ],
        "weixin_works": [
            {
                "agentid": "1009117",
                "corpid": "wxc727955fe6025ed4",
                "userid": "LS004308",
                "open_userid": "o0Nng1Sdt5EFl8ZQ8qKAIpOuV9DI"
            }
        ]
    }
}

Delete Customer

This interface is used to delete customer information.

Request Method

DELETE /customers/destroy_customer

Request Parameters (Query String)

Parameter NameRequiredDescription
typeYesCondition Type
contentYesCondition Content
For more details, see the Get Customer Details API.

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
customer_idIntegerDeleted customer ID

Example

curl https://demo.udesk.cn/open_api_v1/customers/destroy_customer?type=id&content=1&email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 -X DELETE

Response

{
    "code": 1000,
    "customer_id": 1
}

Get Customer History List

This interface is used to obtain the historical record information of specified condition customers.

Request Method

GET /customers/feeds

Request Parameters (Query String)

Attribute NameRequiredDescription
typeYesCondition Type
contentYesCondition Content
pageNoPage number, starting from 1, default is 1
page_sizeNoNumber of items per page, default is 20, maximum is 100
For more details, see the Get Customer Details API.

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
feedsArrayCustomer history list, see below
metaObjectPagination information, see Common Data

feeds Elements

The elements of feeds are divided into five categories, and all types of elements contain the following attributes:

Attribute NameTypeDescription
feed_typeStringType

The range of values is as follows:

ValueMeaning
TicketTicket
CallLogCall Log
ImSubSessionChat Record
CustomerFollowUpFollow-up Record
AlternationChange Record

At the same time, different types also contain their own unique attributes: Ticket

Attribute NameTypeDescription
idIntegerTicket ID
subjectStringTitle
contentStringContent
user_idIntegerCustomer ID
user_group_idIntegerResponsible Customer Service Group ID
status_zh_nameStringTicket Status in Chinese
created_atDate-TimeTicket Creation Time

CallLog

Attribute NameTypeDescription
idIntegerCall Log ID
call_typeStringCall Type
resultStringCall Result
durationIntegerCall Duration
created_atDate-TimeCall Creation Time

ImSubSession

Attribute NameTypeDescription
idIntegerChat Record ID
platformStringChat Platform
customer_msg_numIntegerNumber of Customer Messages
agent_msg_numIntegerNumber of Customer Service Messages
created_atDate-TimeChat Creation Time

CustomerFollowUp

Attribute NameTypeDescription
idIntegerFollow-up Record ID
user_idIntegerCustomer Service ID
contentStringRecord Content
created_atDate-TimeFollow-up Record Creation Time
agent_nameStringCustomer Service Nickname

Alternation

Attribute NameTypeDescription
timeDate-TimeTime of Change
authorObjectOperator
summaryStringChange Description

The format of the author is as follows:

Attribute NameTypeDescription
idIntegerCustomer Service ID
nick_nameStringCustomer Service Nickname

Example

curl https://demo.udesk.cn/open_api_v1/customers/feeds?type=id&content=1&email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "feeds": [
        {
            "feed_type": "Ticket",
            "id": 1,
            "content": "<p>Demo Ticket</p>",
            "subject": "Demo Ticket",
            "user_id": 1,
            "user_group_id": 1,
            "status_zh_name": "open",
            "created_at": "2006-01-02T15:04:05.000+08:00"
        },
        {
            "feed_type": "Alteration",
            "time": "2006-01-02T15:04:05.000+08:00",
            "author": {
                "id": null,
                "nick_name": null
            },
            "summary": "Responsible person: [None] --> Test Customer Service 1 "
        }
    ],
    "meta": {
        "current_page": 1,
        "total_pages": 1,
        "total_count": 6
    }
}

Get Customer Filter List

This interface is used to obtain information about all customer filters.

Request Method

GET /customers/filters

Request Parameters

None

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
customer_filtersArrayList of customer filters, see below

customer_filters Elements

Attribute NameTypeDescription
idIntegerUnique Identifier
nameStringName
activeBooleanIs Active

Example

curl https://demo.udesk.cn/open_api_v1/customers/filters?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "customer_filters": [
        {
            "id": 1,
            "name": "Test Filter 1",
            "active": true,
        },
        {
            "id": 2,
            "name": "Test Filter 2",
            "active": false,
        }
    ]
}

Get Customer Custom Fields (Deprecated)

This interface is used to obtain information about all customer custom fields.

Request Method

GET /customers/custom_fields

Request Parameters

None

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
custom_fieldsArrayList of customer custom fields, see below

custom_fields Elements

Attribute NameTypeDescription
idIntegerUnique Identifier
agent_permissionIntegerAgent Permission
customer_permissionIntegerCustomer Permission
custom_field_nameStringUnique Identifier Name, usually "SelectField_" or "TextField_" prefix with id
titleStringField Name
commentStringDescription
content_typeStringType
optionsArrayOptions for selection type fields, see example

agent_permission

ValueMeaning
1Required
2Optional

customer_permission

ValueMeaning
0Invisible
1Visible
2Visible and Editable
3Required

Example

curl https://demo.udesk.cn/open_api_v1/customers/custom_fields?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "custom_fields": [
        {
            "id": 1,
            "agent_permission": 1,
            "customer_permission": 2,
            "title": "Single-line text field",
            "comment": "",
            "content_type": "text",
            "custom_field_name": "TextField_1",
            "options": null
        },
        {
            "id": 2,
            "agent_permission": 1,
            "customer_permission": 1,
            "title": "Multiline text field",
            "comment": "",
            "content_type": "area_text",
            "custom_field_name": "TextField_2",
            "options": null
        },
        {
            "id": 3,
            "agent_permission": 1,
            "customer_permission": 3,
            "title": "Date Field",
            "comment": "",
            "content_type": "date",
            "custom_field_name": "TextField_3",
            "options": null
        },
        {
            "id": 4,
            "agent_permission": 1,
            "customer_permission": 3,
            "custom_field_name": "TextField_4",
            "title": "Time Field",
            "content_type": "time",
            "comment": "",
            "options": null
        },
        {
            "id": 5,
            "agent_permission": 1,
            "customer_permission": 3,
            "custom_field_name": "TextField_5",
            "title": "Date Time Field",
            "content_type": "datetime",
            "comment": "",
            "options": null
        },
        {
            "id": 6,
            "agent_permission": 1,
            "customer_permission": 3,
            "custom_field_name": "TextField_6",
            "title": "Link Field",
            "content_type": "link",
            "comment": "",
            "options": null
        },
        {
            "id": 7,
            "agent_permission": 1,
            "customer_permission": 3,
            "custom_field_name": "TextField_7",
            "title": "Positive integer field",
            "content_type": "number",
            "comment": "",
            "options": null
        },
        {
            "id": 8,
            "agent_permission": 1,
            "customer_permission": 3,
            "custom_field_name": "TextField_8",
            "title": "Numeric field",
            "content_type": "numeric",
            "comment": "",
            "options": null
        },
        {
            "id": 1,
            "agent_permission": 1,
            "customer_permission": 2,
            "custom_field_name": "SelectField_1",
            "title": "Drop List Field",
            "content_type": "droplist",
            "comment": null,
            "options": [
                {"0": "option 1"},
                {"1": "option 2"},
                {"2": "option 3"}
            ]
        },
        {
            "id": 2,
            "agent_permission": 1,
            "customer_permission": 2,
            "custom_field_name": "SelectField_2",
            "title": "Radio Field",
            "content_type": "radio",
            "comment": null,
            "options": [
                {"0": "option 1"},
                {"1": "option 2"}
            ]
        },
        {
            "id": 3,
            "agent_permission": 1,
            "customer_permission": 2,
            "custom_field_name": "SelectField_3",
            "title": "Checkbox field",
            "content_type": "checkbox",
            "comment": null,
            "options": [
                {"0": "option 1"},
                {"1": "option 2"},
                {"2": "option 3"},
                {"3": "option 4"}
            ]
        }
    ]
}

Customer Bulk Import

This interface is used to create multiple customer information at once. Note: This method allows only one call per minute.

Request Method

POST /customers/batch_import_async

This feature is asynchronous, and up to 100 customers can be imported at a time. The interface returns code 1000, which only indicates that the import data has been successfully received and does not mean that the import is complete. If you are concerned about the import results, you need to configure the notification address. After the import is completed, a notification will be sent to the notification address, see Configure Notification Address for details.

Request Parameters (Request Body)

Parameter NameTypeRequiredDescription
customersArrayYesArray of customer information, see below

customers Elements

Parameter NameTypeRequiredDescriptionLimitations
nick_nameStringYesNameMaximum length of 255 characters
descriptionStringNoDescriptionMaximum length of 255 characters
emailsArrayNoEmail array
cellphonesArrayNoPhone number array
organization_idIntegerNoCustomer company ID
owner_idIntegerNoResponsible customer service ID
owner_group_idIntegerNoResponsible customer service group ID
levelStringNoLevel, see Customer Data, default is "normal"
custom_fieldsObjectNoCustom fields, see Customer Data
tagsStringNoTags, separated by commas for multiple tagsMaximum length of 255 characters
open_api_tokenStringNoExternal unique identifierMaximum length of 255 characters
weixinsArrayNoWeChat information
weixin_minisArrayNoWeChat Mini Program information

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success

Example

curl https://demo.udesk.cn/open_api_v1/customers/batch_import_async?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2
 \
-X POST \
-H 'content-type: application/json' \
-d'
{
    "customers": [
        {
            "nick_name": "test customer 2",
            "emails": ["customer2@sample.com", "customer2@qq.com"],
            "cellphones": ["13100000002", "13200000002"],
            "owner_id": 1,
            "owner_group_id": 1,
            "custom_fields": {
                "TextField_1": "Plain text content",
                "TextField_2": "Multiline text content 1\r\nMultiline text content 2",
                "TextField_3": "2016-08-11",
                "TextField_4": "14:44:36",
                "TextField_5": "2017-05-03 14:44",
                "TextField_6": "https://www.sample.com",
                "TextField_7": "13",
                "TextField_8": "13.33",
                "SelectField_1": ["0"],
                "SelectField_2": ["0"],
                "SelectField_3": ["0","3"]
            },
            "weixins": [
                {
                    "appid": "wxf54489a1azz51885",
                    "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk",
                    "unionid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
                },
                {
                    "appid": "wxf54489a1azz51885",
                    "openid": "og8dL0nfmm7wVjIVzk1deqt9Vkdk"
                }
            ],
            "weixin_minis": [
                {
                    "appid": "wxc7279f8eefd70a4a",
                    "openid": "oa3cT0mano9wVhIpkp3drqy9yDuw",
                    "unionid": "sadgsathGdfsgBfhkfhgddfxzfAs"
                },
                {
                    "appid": "wxc7279f8eefd70a4a",
                    "openid": "asdgasda0mano9hIpkp3drqy9yDuw"
                }
            ]
        }
    ]
}'

Response

{
    "code": 1000
}

Customer Bulk Export

This interface is used to export a large number of customer information. Supports filtering customers based on specified filters. Supports searching for customers by keyword.

Request Method

GET /customers/export The method of using this interface:

  1. Use filter_id or query to call the interface, and the result will include the first batch of data and scroll_id.
  2. After the data is processed, use the scroll_id returned from the previous call to call the interface again (note that you do not need to pass filter_id or query this time), and the result will include the second batch of data and a new scroll_id.
  3. Repeat step 2 until the result returns an empty customers. Note:
  4. For subsequent calls, you need to use the new scroll_id returned from the previous call. The scroll_id expires after 1 minute.
  5. If the filter_id parameter is incorrect, it will query without filtering (i.e., return all customers).

Request Parameters (Query String)

Parameter NameTypeRequiredDescriptionLimitations
filter_idIntegerNoCustomer filter ID, exports the filtered results of this filter
queryStringNoKeyword for customer search, exports the search results for this keyword
scroll_idStringNoID for obtaining the next batch of data, obtained from the result of the previous call

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
scroll_idStringID for obtaining the next batch of data
totalIntegerTotal number of data
customersArrayCustomer list, see Customer Data

Note: The maximum number of customers retrieved in one go is 1000; when the number of customers in the return result is 0, it indicates the end of the export.

Example

# First call
curl https://demo.udesk.cn/open_api_v1/customers/export?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2
&filter_id=1
# Follow-up call
curl https://demo.udesk.cn/open_api_v1/customers/export?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2
&scroll_id=DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAABHFnVvTTZEQXFwUkZ5S2wtSkdabmVBbWcAAAAAAAAASBZ1b002REFxcFJGeUtsLUpHWm5lQW1nAAAAAAAAAEkWdW9NNkRBcXBSRnlLbC1KR1puZUFtZwAAAAAAAABKFnVvTTZEQXFwUkZ5S2wtSkdabmVBbWcAAAAAAAAASxZ1b002REFxcFJGeUtsLUpHWm5lQW1n

Response

{
    "code": 1000,
    "scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAABHFnVvTTZEQXFwUkZ5S2wtSkdabmVBbWcAAAAAAAAASBZ1b002REFxcFJGeUtsLUpHWm5lQW1nAAAAAAAAAEkWdW9NNkRBcXBSRnlLbC1KR1puZUFtZwAAAAAAAABKFnVvTTZEQXFwUkZ5S2wtSkdabmVBbWcAAAAAAAAASxZ1b002REFxcFJGeUtsLUpHWm5lQW1n",
    "total": 10000,
    "customers": [...]
}

Data Structure - Customer

Customer

Attribute NameTypeDescriptionLimitations
idIntegerUnique identifier
nick_nameStringNameMaximum length of 255 characters
levelStringCustomer level
descriptionStringDescriptionMaximum length of 255 characters
owner_idIntegerResponsible customer service ID
owner_group_idIntegerResponsible customer service group ID
custom_fieldsObjectCustom fields, see below for details
open_api_tokenStringExternal unique identifierMaximum length of 255 characters
organization_idIntegerCustomer company ID
organization_idsArray(Integer)Customer company list
default_organization_idIntegerDefault company ID
is_blockedBooleanWhether it is added to the blacklist
tagsArrayTag list, see below for details
rich_tagsArrayBackground color tag list, see below for details
emailStringMain emailMaximum length of 255 characters
other_emailsArrayOther email list
cellphonesArrayContact phone list
weixinsArrayWeChat information
platformStringCreation channel in Chinese (this field will be gradually abandoned)
source_channelStringCustomer source in Chinese
first_contact_atDate-TimeFirst contact time
last_contact_atDate-TimeLast contact time
first_contact_at_via_phoneDate-TimeFirst phone contact time
last_contact_at_via_phoneDate-TimeLast phone contact time
first_contact_at_via_imDate-TimeFirst online customer service contact time
last_contact_at_via_imDate-TimeLast online customer service contact time
weixin_minisArrayWeChat Mini Program information
web_tokenStringCustomer web identifierMaximum length of 255 characters
sdk_tokenStringCustomer SDK identifierMaximum length of 255 characters

level

ValueMeaning
normalGeneral
vipVIP

source_channel

Chinese NameEnglish Name
Manual Creationmanual
Phone Incallin
Phone Outcallout
WeChatwechat
Weiboweibo
Online Customer Serviceweb_im
API or SDKapi
Feedback Formfeedback
Emailmail
Bulk Importimport
Enterprise WeChatqywx
WeChat Customer Service Numberweixin_kf
WeChat Mini Programweixin_mini
Baidu BCPbaidu
Twittertwitter
Facebookfacebook
Lineline
Whatsappwhatsapp
Douyin Enterprise Numbertiktok
Video Customer Servicempv

platform

NameDescription
emailEmail
weiboWeibo
wechatWeChat
imInstant Chat
callPhone
feedbackFeedback Tag
hcHelp Center
manual_inputManual Entry
apiAPI

tags

Attribute NameTypeDescription
idIntegerTag ID
nameStringTag Name
company_idIntegerCompany ID (Currently unused)

rich_tags

Attribute NameTypeDescription
idIntegerTag ID
nameStringTag Name
colorStringTag Color
company_idIntegerCompany ID (Currently unused)

custom_fields

custom_fields example:

{
    "custom_fields": {
        "TextField_1": "Normal text content",                    // Normal text
        "TextField_2": "Multi-line text content1\r\nMulti-line text content2",  // Multi-line text
        "TextField_3": "2016-08-11",                              // Date
        "TextField_4": "14:44:36",                               // Time
        "TextField_5": "2017-05-03 14:44",                        // Date-Time
        "TextField_6": "https://www.sample.com",                 // Link
        "TextField_7": "13",                                     // Positive integer
        "TextField_8": "13.33",                                  // Numeric value
        "SelectField_1": ["0"],                                 // Dropdown list, Dropdown option 1
        "SelectField_2": ["0"],                                 // Radio button, Radio option 1
        "SelectField_3": ["0","3"]                               // Checkbox, Checkbox options 1, 4
    }
}

Merge Customer Information

This interface is used to merge the information of two customers.

Request Method

POST /customers/merge

Request Parameters (Query String)

Parameter NameTypeRequiredDescriptionLimitations
from_typeStringYesfrom_type condition type, used to find the customer to be deleted after merging, see below for details
from_contentStringYesfrom_content condition content, used to find the customer to be deleted after merging
to_typeStringYesto_type condition type, used to find the customer to be retained after merging, see below for details
to_contentStringYesto_content condition content, used to find the customer to be retained after merging

Condition Types

ValueMeaning of content
emailCustomer email
cellphoneCustomer phone
customer_tokenCustomer external unique identifier
weixin_openidCustomer WeChat openid
weibo_openidCustomer Weibo openid
sdk_tokenCustomer SDK identifier
web_tokenCustomer web identifier
weixin_mini_openidCustomer Mini Program openid

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
idIntegerID of the customer retained after merging

Example

curl https://demo.udesk.cn/open_api_v1/customers/merge?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X POST \
-H 'content-type: application/json' \
-d '
{
    "from_type": "email",
    "from_content": "from_customer@sample.com",
    "to_type": "email",
    "to_content": "to_customer@sample.com"
}'

Response

{
    "code": 1000,
    "id": 27
}

Error Code Description

Error CodeMessage InformationException:message InformationDescription
429API interface exceeds request limitNoneThe request frequency of this interface exceeds the limit
2000Unknown errorMissing custom field XXXWhen the custom field is set to required, the parameter {custom_fields} is not filled in or does not meet the requirements
param is missing or the value is empty: customerNo parameters in {customer}
Email duplicate: customer id = XXXThe {email} parameter has been used by the customer with id XXX
web_token duplicate: XXXThe {web_token} parameter has been used
web_token format error: XXXThe format of the {web_token} parameter does not meet the requirements
web_token must be a stringThe {web_token} parameter must be a string
Incorrect parameter formatThe input parameter format is incorrect
Verification failed: Email is invalidThe {email} parameter format is incorrect
WeChat information (appid: XXX, openid: XXX) already exists in customer (id: XXX)This WeChat information has been used by the customer with id XXX
WeChat Mini Program information (appid: XXX, openid: XXX) already exists in customer (id: XXX)This WeChat Mini Program information has been used by the customer with id XXX
Verification failed: Phone XXX has been usedThe phone number in {cellphones} has been used
Company id does not existThe {organization_id} parameter is incorrect
Cannot find customer serviceThe {owner_id} parameter is incorrect
Customer service exists but customer service group does not existOnly the customer service id {owner_id} is entered, and the correct {owner_group_id} is also required
Company does not have this customer service groupThe {owner_group_id} parameter is incorrect
Customer service does not belong to this customer service groupThe parameters {owner_group_id} and {owner_id} do not match
'xxx' is not a valid levelThe value of the {level} parameter is not within the valid range
undefined method `each' for "qweasd":StringThe format of the {custom_fields} parameter is incorrect
undefined method `each_with_index' for nil:NilClassThe {customer} parameter is an empty array or null, or this parameter is not filled in
Import data is emptyThe imported customer data is empty
Import quantity (XXX) cannot exceed 100The imported customer quantity exceeds the maximum limit of 100
Merge customer failed: Cannot merge to selfNoneWhen merging users, the two fields point to the same customer
Invalid unique identifier typeNoneRequired parameter is not filled in
Couldn't find CustomerNoneRequired parameter is not filled in
2005The resource was not foundCouldn't find CustomerThe provided parameter {content} did not find matching data
2060Invalid unique identifier typeInvalid unique identifier typeThe {type} parameter was not passed in
2062Parameter errorFailed to get customer informationThe {filter_id} or {scroll_id} parameter is incorrect
206211Parameter page_size is invalidNoneThe {page_size} parameter is not within the valid range
206201Parameter page is invalidNoneThe {page} parameter is not within the valid range