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
| Parameter | Type | Required | Description |
|---|
| token | string | Yes | API token obtained in settings |
| filter | string | No | active - 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
| Field | Description |
|---|
| api_id | Channel number |
| api_tip | Type of communication channel (whatsapp, tg, tg_bot, ...) |
| pay_state | Payment status (active / archive) |
| phone | Phone number connected to the channel |
| api_tag | Channel name |
| state | Connection status (authorized - works / notAuthorized / starting / blocked) |
| hook | Current WebHook URL (if used) |
Possible errors
| Error code | Description |
|---|
| token fail | Token error |
| fail get data | Data 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";
}
}