Change the assigned agent in the chat

POST https://secure.usedesk.com/uapi/chat/changeAssignee

Warning. If you use the server version of Usedesk, you will have a different URL of methods. Check the URL for the API with our team — support@usedesk.com.

The method is used to reassign chats to other agents. It gets the following parameters:

* — required fields

Parameter Value
api_token* Channel API token
chat_id* Chat ID
user_id* ID of the agent you want to assign the chat to

PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'chat_id' => 675,
    'user_id' => 27,
);
$mch_api = curl_init();
curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/chat/changeAssignee');
curl_setopt($mch_api, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($mch_api, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mch_api, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($mch_api, CURLOPT_TIMEOUT, 10);
curl_setopt($mch_api, CURLOPT_POST, true);
curl_setopt($mch_api, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($mch_api, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($mch_api);
return $result;
        


If the request is successful, the server will return the message about successful execution.

Example of a response from server
{
    "chat_id": "675",
    "user_id": "27",
    "url": "https://secure.usedesk.com/chat/675"
}
        


Server response description

Parameter
Description
chat_idChat ID
user_idAgent ID
urlChat link