This method allows you to assign a responsible user for a chat or reset the current responsible user. The functionality is useful for distributing workload among operators and organizing efficient support team operations. Operators responsible for a chat can receive notifications about new messages in their chats.

GET /api2/contact_to_user/{token}/{phone}/{user_id}

Request Parameters
ParameterTypeRequiredDescription
tokenstringYesAPI token obtained from settings
phonestringYesPhone number in international format or chat ID (for Telegram)
user_idstringYesUser ID (can be obtained from the Get User List method) or "none" to reset the responsible user

Success Response
{"err":0,"result":"success"}

Possible Errors
Error CodeDescription
token failToken error
phone failPhone number error
not foundChat not found for the phone number
user not foundUser not found for the user_id
user not activeUser is not active, blocked, or deleted

Usage Examples
curl -X GET "https://wamm.chat/api2/contact_to_user/YOUR_TOKEN/79001234567/100"

To reset the responsible user:

curl -X GET "https://wamm.chat/api2/contact_to_user/YOUR_TOKEN/79001234567/none"
function assignChatToUser($token, $phone, $userId) {
    // Prepare the request URL
    $url = "https://wamm.chat/api2/contact_to_user/$token/$phone/$userId";

    // Execute the request
    $response = file_get_contents($url);

    // Process the response
    if ($response !== false) {
        // Convert the response to an array
        $json_response = json_decode($response, true);

        // Check the result
        if (isset($json_response['err']) && $json_response['err'] === 0) {
            echo "Responsible user successfully assigned";
        } else {
            echo "Error: " . (isset($json_response['err']) ? $json_response['err'] : "Unknown error");
        }
    } else {
        echo "Failed to execute request to the server";
    }
}

// Use the function to assign a responsible user
$token = "YOUR_TOKEN";
$phone = "79001234567";
$userId = "100"; // or "none" to reset the responsible user

assignChatToUser($token, $phone, $userId);