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
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | string | Yes | API token obtained from settings |
| phone | string | Yes | Phone number in international format or chat ID (for Telegram) |
| user_id | string | Yes | User 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 Code | Description |
|---|---|
| token fail | Token error |
| phone fail | Phone number error |
| not found | Chat not found for the phone number |
| user not found | User not found for the user_id |
| user not active | User 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);