Retrieves a user's profile — name, photo, status and whether the account is a bot.
Request
method is "getUser".
| Field |
Type |
Required |
Description |
user_id |
String |
Yes |
The user or bot to look up. |
app_id |
String |
Yes |
The app the user belongs to. |
reference |
String |
Optional |
Your id for this request. Echoed back in the response. |
Preconditions
| Requirement |
Why |
"Manage Users" permission |
Needed to read user profiles in the app. |
Response
userDetails
| Field |
Type |
Returned |
Description |
method |
String |
Yes |
"userDetails" |
user |
User |
Yes |
The user record — id, name, photo, is_bot, status, version. |
app_id |
String |
Yes |
Echoed from the request. |
reference |
String |
Optional |
Echoed from the request. |
SDKs
| SDK |
Call |
Callback |
| Java |
api.getUser(userId, appId, reference); |
onUserDetails(User user, String appId) |
| JavaScript |
api.getUser(userId, appId, reference); |
onUserDetails(user, appId) |
| Python |
napi.get_user(user_id=user_id, app_id=app_id, reference=reference) |
on_user_details(self, user, app_id) |
Example
Request
{
"method": "getUser",
"user_id": "90089584766094863",
"app_id": "90090684293000559",
"reference": "132456789"
}
api.getUser("90089584766094863", "90090684293000559", "132456789");
api.getUser("90089584766094863", "90090684293000559", "132456789");
napi.get_user(user_id="90089584766094863", app_id="90090684293000559", reference="132456789")
Response
{
"method": "userDetails",
"app_id": "90090684293000559",
"reference": "132456789",
"user": {
"id": "90089584766094863",
"name": "Jane Doe",
"is_bot": false,
"status": "",
"version": "0F9o",
"photo": {
"id": "V_0F9o_90089584766094863_0_g0LwjLXs6x.jpg",
"width": 256,
"height": 256,
"thumbnail": {
"id": "V_0F9o_90089584766094863_0_g0LwjLXs6x.jpg.thumb.jpg",
"width": 120,
"height": 120
}
},
"image": "/9j/4AAQSkZJRgABAQAASABIAAD…"
}
}