This method allows you to remove a contact from the WAMM.chat database. It is important to note that the contact is deleted only from WAMM.chat but remains in the messenger. The method is useful for cleaning up outdated contacts or managing your customer base according to your business processes.

GET /api2/contact_delete/{token}/?phone={phone}

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

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

Possible Errors
Error CodeDescription
token failToken error
acc not authorizedConnection is not authorized
phone failPhone number error
phone not foundPhone number not found in contacts

Usage Examples
curl -X GET "https://wamm.chat/api2/contact_delete/YOUR_TOKEN/?phone=79001234567"
function deleteContact($token, $phone) {
    // Prepare the request URL
    $url = "https://wamm.chat/api2/contact_delete/$token/?phone=$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 the result
        if (isset($json_response['err']) && $json_response['err'] === 0) {
            echo "Contact successfully deleted";
        } 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 delete a contact
$token = "YOUR_TOKEN";
$phone = "79001234567";

deleteContact($token, $phone);