User
Definitions
User
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
id | string | user id |
name | string? | user name[1] |
nick | string? | user nickname[1] |
avatar | string? | user avatar |
is_bot | boolean? | whether the user is a bot |
TIP
[1] Difference between name and nick
Both fields can be used to identify a user. On some platforms (e.g., Telegram), a user may have multiple types of names, so the SDK can set both fields. On other platforms, these concepts may not be distinct, in which case the SDK only needs to set either name or nick based on semantics.
In application-level implementations, nick takes precedence over name because nicknames are easier for users to recognize and understand. If you are developing a client based on the Satori protocol, you should prioritize displaying the nick field for usernames and only use the name field when nick is absent.
API
Get User Information
POST /user.get| FIELD | TYPE | DESCRIPTION |
|---|---|---|
user_id | string | user id |
Get a user by id. Returns a User object.
Get Friend List
POST /friend.list| FIELD | TYPE | DESCRIPTION |
|---|---|---|
next | string? | pagination token |
Get the friend list. Returns a paginated list of User objects.
Handle Friend Request
POST /friend.approve| FIELD | TYPE | DESCRIPTION |
|---|---|---|
message_id | string | request id |
approve | boolean | whether to approve the request |
comment | string? | comment |
Handle a friend request.
Events
friend-request
Triggered when a new friend request is received. Required resource: user.