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
| Parameter | Type | Required | Description |
|---|
| token | string | Yes | API token obtained from the settings |
| phone | string | Yes | Phone number in international format or chat ID (for Telegram) |
Success Response
{"err":0,"result":"delete"}
Possible Errors
| Error Code | Description |
|---|
| token fail | Token error |
| acc not authorized | Connection is not authorized |
| phone fail | Phone number error |
| phone not found | Phone 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);