This method allows you to change the chat status to "completed". Completed chats are hidden from the list of active chats, which helps maintain order in the interface by focusing on current dialogues. When a new message arrives in a completed chat, it will automatically return to the "open" status.

GET /api2/contact_complete/{token}/{phone}

Request Parameters
ParameterTypeRequiredDescription
tokenstringYesAPI token obtained in the settings
phonestringYesPhone number in international format or chat ID for Telegram

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

Possible Errors
Error CodeDescription
token failToken error
not foundChat not found
phone failPhone number error

Usage Examples
curl -X GET "https://wamm.chat/api2/contact_complete/YOUR_TOKEN/79001234567"
function completeChat($token, $phone) {
    // Prepare the request URL
    $url = "https://wamm.chat/api2/contact_complete/$token/$phone";
    
    // 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 for errors
        if (isset($json_response['err'])) {
            if ($json_response['err'] == 0 && $json_response['result'] == 'success') {
                echo "Chat successfully completed";
            } else {
                echo "Error: " . $json_response['err'];
            }
        } else {
            echo "Failed to process the server response";
        }
    } else {
        echo "Failed to execute the request to the server";
    }
}

// Use the function to complete the chat
$token = "YOUR_TOKEN";
$phone = "79001234567";

completeChat($token, $phone);