This function will delete a contact group, including the contacts within it.
https://api.txtlocal.com/delete_group/
<?php // Account details $apiKey = urlencode('Your apiKey'); // Group details $group_id = 123456; // Prepare data for POST request $data = array('apikey' => $apiKey, 'group_id' => $group_id); // Send the POST request with cURL $ch = curl_init('https://api.txtlocal.com/delete_group/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php // Account details $apiKey = urlencode('Your apiKey'); // Group details $group_id = 123456; // Prepare data for POST request $data = 'apikey=' . $apiKey . '&group_id=' . $group_id; // Send the GET request with cURL $ch = curl_init('https://api.txtlocal.com/delete_group/?' . $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php require('Textlocal.class.php'); $Textlocal = new Textlocal(false, false, 'your apiKey'); $group_id = 41029; $response = $Textlocal->deleteGroup($group_id); print_r($response); ?>
group_id | ID of the group. Can either be found within Messenger (in the "Reports" - "Advanced Reports" - "List of Group ID's" section) or by running the get_groups command. Additionally group 5 contains "contacts" and group 6 contains "opt-outs". |
---|---|
Login Parameters (Additional Information) | |
apiKey | You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address. |
Caution: This will delete the specified group, once deleted, it cannot be recovered.
{ "status":"success" }
<?xml version="1.0" encoding="UTF-8" ?> <response> <status>success</status> </response>
Error Codes | |
10 | Invalid group ID. |
---|---|
25 | No group ID specified. |
62 | Cannot delete specified group. |