The method returns a complete list of users of the WAMM.chat account, including active, blocked, and deleted ones. The response contains information about the user's role, contact details, and activity status. The method is useful for managing access, auditing activity, and controlling account states. If you have multiple channels, regardless of which channel the token is requested from, information about all users is displayed.
Example request:
GET https://wamm.chat/api2/user_list/{token}
Request parameters
| Parameter | Type | Required | Description |
|---|
| token | string | Yes | API token obtained in the settings |
Success response
{
"err": 0,
"data": [
{
"user_id": 100,
"acc": "admin",
"email": "user1@gmail.com",
"name": "User Name1",
"dt_reg": "2022-10-04 23:17:22",
"dt_active": "2024-02-29 11:29:49",
"lock": 0,
"deleted": 0
},
{
"user_id": 110,
"acc": "user",
"email": "user2@gmail.com",
"name": "User Name2",
"dt_reg": "2020-08-18 18:43:46",
"dt_active": "2024-01-25 17:55:21",
"lock": 0,
"deleted": 0
}
]
}
Response field descriptions
| Field | Description |
|---|
| user_id | User identifier |
| acc | User role (user / admin) |
| email | User email |
| name | User name |
| dt_reg | Registration date |
| dt_active | Date of last activity in the program |
| lock | Block status (0 - active, 1 - blocked) |
| deleted | Deletion status (0 - active, 1 - deleted) |
Possible errors
| Error code | Description |
|---|
| token fail | Error in token |
| fail get data | Data retrieval error |
Usage examples
curl -X GET "https://wamm.chat/api2/user_list/YOUR_TOKEN"
function getUserList($token) {
// Prepare the request URL
$url = "https://wamm.chat/api2/user_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 "User list successfully retrieved";
return $json_response['data'];
} else {
echo "Error: " . $json_response['err'];
return null;
}
} else {
echo "Failed to process the response from the server";
return null;
}
} else {
echo "Failed to make a request to the server";
return null;
}
}
// Use the function to get the list of users
$token = "YOUR_TOKEN";
$users = getUserList($token);
// Output information about users
if ($users !== null) {
foreach ($users as $user) {
echo "ID: " . $user['user_id'] . ", Name: " . $user['name'] .
", Email: " . $user['email'] . ", Role: " . $user['acc'] .
", Active: " . ($user['lock'] == 0 && $user['deleted'] == 0 ? 'Yes' : 'No') . "\n";
}
}