This method allows you to retrieve a complete list of connected communication channels (messengers) for the account. The response contains information about the channel type, connection status and payment, as well as settings. It is useful for getting an overview of the connections and their status in your account. If you have multiple channels, regardless of which channel's token is used for the request, information about all channels of the account, both active and archived, is displayed.


Example request:

GET https://wamm.chat/api2/channel_list/{token}/{filter}

Request parameters
ParameterTypeRequiredDescription
tokenstringYesAPI token obtained in settings
filterstringNoactive - active channels, archive - archived, statusOff - active not connected, statusOn - active connected, one - single current channel matching the API token.

If no value is specified - all channels of any status

Success response
{
    "err": 0,
    "data": [
        {
            "api_id": 100,
            "api_tip": "tg",
            "pay_state": "active",
            "phone": "79181234567",
            "api_tag": "Name 1",
            "state": "authorized",
            "hook": ""
        },
        {
            "api_id": 110,
            "api_tip": "tg",
            "pay_state": "active",
            "phone": "6289668857000",
            "api_tag": "Name 2",
            "state": "authorized",
            "hook": ""
        }
    ]
}

Response field description
FieldDescription
api_idChannel number
api_tipType of communication channel (whatsapp, tg, tg_bot, ...)
pay_statePayment status (active / archive)
phonePhone number connected to the channel
api_tagChannel name
stateConnection status (authorized - works / notAuthorized / starting / blocked)
hookCurrent WebHook URL (if used)

Possible errors
Error codeDescription
token failToken error
fail get dataData retrieval error or request returned no data (empty)

Usage examples
curl -X GET "https://wamm.chat/api2/channel_list/YOUR_TOKEN"
function getChannelList($token) {
    // Prepare the request URL
    $url = "https://wamm.chat/api2/channel_list/$token";
    
    // 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 && isset($json_response['data'])) {
                echo "Channel list successfully retrieved";
                return $json_response['data'];
            } else {
                echo "Error: " . $json_response['err'];
                return null;
            }
        } else {
            echo "Failed to process server response";
            return null;
        }
    } else {
        echo "Failed to make request to server";
        return null;
    }
}

// Use the function to get the list of channels
$token = "YOUR_TOKEN";
$channels = getChannelList($token);

// Output channel information
if ($channels !== null) {
    foreach ($channels as $channel) {
        echo "ID: " . $channel['api_id'] . ", Type: " . $channel['api_tip'] . 
             ", Phone: " . $channel['phone'] . ", Status: " . $channel['state'] . "\n";
    }
}