This method allows you to change the chat status to "open". This is particularly useful when a previously completed chat needs to be returned to the list of active chats for continued work. Open chats are visible in the main program interface and are available for active interaction.
curl -X GET "https://wamm.chat/api2/contact_open/YOUR_TOKEN/79001234567"
function openChat($token, $phone) {
// Prepare the request URL
$url = "https://wamm.chat/api2/contact_open/$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 opened";
} 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 open a chat
$token = "YOUR_TOKEN";
$phone = "79001234567";
openChat($token, $phone);