Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Amity SDK's do not store or manage any user data. This means that you do not have to import or migrate existing user profiles into the system, user management should be handled by your application code. Instead, every user is simply represented by a unique userID
, which can be any string that uniquely identifies the user and is immutable throughout its lifetime.
A database primary key would make an ideal
userID
. Conversely, something like username or emails is not recommended as those values may change over time.
If you wish to assign additional permissions for a user, for example, moderation privileges or different sending limits, you can provide an array of roles to assign to this user. Roles are defined in the admin panel and can be tied to an unlimited number of users. Once again, Amity does not store or manage any user data, which means you do not have to import or migrate existing users into the system. It also means that Amity cannot provide user management functionalities like list of users, or limit actions of certain users (e.g. user permissions). Instead, these functionalities should be handled by the rest of your application's capabilities and your server.
Though the SDK does not store and should not be responsible for the handling User profile data for your application; We do provide tools to make some surface-level queries and searches for existing user accounts. With the help of our UserRepository
class, you will be able to list all the users, search for list of users whose display name matches your search query and get AmityUser
object from user ID.
You can ban a user globally. When users are globally banned, they can no longer access Amity's network and will be forcibly removed from all their existing channels.
Refer global ban documentation for instructions on how to globally ban a user.
For more information please visit to User & Content Management
Name
Data Type
Description
Attributes
userId
string
The id of this user
roles
Array.<string>
A list of user's roles
displayName
string
The display name of the user
flagCount
integer
The number of users that have flagged this user
metadata
Object
The metadata of the user
hashFlag
Object
A hash for checking internally if this user was flagged by the user
createdAt
date
The date/time the user was created at
updatedAt
date
The date/time the user was updated at
isGlobalBan
Boolean
Flag that indicates if the user is globally banned. True
means the user is globally banned.
Note: This is not yet supported for Typescript
avatarCustomUrl
String
Custom Url provided for this user avatar
isDeleted
Boolean
Flag that indicates if the user is deleted
Delete User API is called to delete a user from the system. The display name of the deleted user is replaced with “Deleted User”. This API can be called only by admin users.
Please note that this action is a hard delete, and all deleted data will be lost and cannot be recovered.
When deleting a user, you can specify that the user should be marked as deleted but the user’s data should remain unchanged, or you can specify that all personal data associated with the user should be deleted:
if the deleteAll
parameter is set to true, all personal data (i.e. profile, photos, images, and files), message channels, posts and comments of the user will be deleted.
the markMessageDeleted
parameter, when set to true, deletes all message channels and messages that the user has created
the hardDeletePost
parameter, if set to true, deletes all posts created by the user as well as the comments, reactions, child posts and child comments of the corresponding post
the hardDeleteComment
parameter, if set to true, deletes all comments and reactions of the user
Once a user has been deleted from the system, the account cannot be reactivated under any circumstances. In order to protect the user account data, no other user will be allowed to reactivate the account after it has been deleted by the user.
The user's system ID will still be stored in the database, but to protect the user's identity, the account's username will be replaced with the text "Deleted User". All deleted accounts will be marked as "Deleted Account".
If the user account is deleted, all conversation channels created by that user will be deleted immediately and no other user will be able to access those channels afterwards.
After the account is deleted, all messages for all channels and all attachments that created by the user are deleted and cannot be restored.
When a user is deleted, the channel members are updated in all channels where the user was a member, so that only active users are counted in the channels.
All the user's data, including profile, photos, videos, images, text, audio, video, attachments, files and anything else that the user has added to the system as a user will be permanently deleted from the system and cannot be recovered.
All posts created/shared by the deleted user will be deleted and all comments added by the deleted user will also be removed from all posts. No comments or sub-posts will be available after the user deletes the account.
All reactions and comments posted by the deleted user are detected and updated in the posts.
The status of the user's account is marked as "deleted" when queried and the user can no longer access it.
API response will be different based on the request and records match. The request may have successful response , or it may have bad request error, and it may respond as User not found. As the responses of API call are mentioned below.
{
"success":true
}
{ "status": "error",
"code": 400000,
"message": "User is already deleted"
}
{ "status": "error",
"code": 400400,
"message": "User Not Found."
}
Update current user information, including display name, avatar, user description, metadata, etc., using the updateUser
method in the 'amityClient' class. This method updateUser
accepts these optional parameters:
The method accepts the following optional parameters:
displayName
- user's display name
description
- user's description
avatarFile
- file ID of the user's avatar
avatarCustomUrl
- custom url of the user's avatar
roles
- user's role
metadata
- user's metadata
The updateCurrentUser
method accepts the following optional parameters:
displayName
- user's display name
description
- user's description
avatarFile
- file ID of the user's avatar
avatarCustomUrl
- custom url of the user's avatar
roles
- user's role
metadata
- user's metadata
Below is a sample code on how to update the current user's display name, description, and metadata. This method returns a promise. If the update is successful, the method will return true,
else it throws an error.
You can upload an image and set it as an avatar for the current user.
First, you need to upload image using AmityFileRepository
and then update the image info.
Step 1 — Upload an image:
Step 2 — Passing AmityImageData
from step 1 into the builder, and call user update API.
If you have an avatar present in your current system/server and just want to integrate that existing avatar to AmitySDK, you can just set the URL for the avatar directly.
Note: getAvatarInfo
provides the information associated with a particular Avatar
First, you need to upload image and then update the image info. If you have an avatar present in your current system/server and just want to integrate that existing avatar to AmitySDK, you can just set the URL for the avatar directly.
If you have an avatar present in your current system/server and just want to integrate that existing avatar to AmitySDK, you can just set the URL for the avatar directly.
Either you wish to let us handle your user's avatar, or if you already have a system for it we got you covered. The 2 properties avatarFileId
and avatarCustomUrl
answer those two use-cases separately.
You can easily retrieve the url of a file from our FileRepository object and use it to display in your app later on. Here's an example in React:
You can easily retrieve the url of a file using observeFile
and use it to display in your app later on. Here's an example in React:
In Amity SDK, creating a new user can be done through the login method. Once the user account has been created, the user can then log into the app using their userId
and displayName
using the SDK's social and chat features.
You may need to create a new user account via the SDK, such as when integrating the SDK with an existing user authentication system. In these cases, you can use the login
method. Here's how the login
method works:
If a user already exists for the specified userId
, the SDK will log the user into the app using the provided userId
. The displayName
parameter can be updated upon calling the login
method. If the displayName
parameter is not provided, the system will retain the existing user's displayName
.
If a user account does not already exist for the specified userId
, the SDK will automatically create a new user account with the provided displayName
and log the user into the app. If displayName
is not provided, the userId
will be used as displayName
.
Note:
When user edits / adds their display name, it can be up to 100 characters in length.
When a user ID is created, it can be up to 50 characters in length.
If displayName
is passed, but secured mode is enabled, the values will be ignored.
Version 6 and Beta(v0.0.1)
API token management is a login authentication process that allows an amity user to access amity applications in a unified and streamlined environment.
Amity SDK provides AmityUserTokenManager to manage user credentials. This includes an access token that can be used to access some Beta features.
NOTE: Please be aware that we do not provide any API to support the usage of user tokens on the client SDK. To use this user token, you must interact with ASC services with your own effort.
To create a new user token, refer to the following example and the parameters are.
userId
: This is a required parameter of type String
that represents the unique identifier of the user whose credentials are being managed by the AmityUserTokenManager
.
displayName
: This is an optional parameter of type String
that represents the display name of the user. If provided, it will be associated with the user's credentials.
authToken
: This is an optional parameter of type String
that represents the user's authentication token. If provided, it will be used to authenticate the user when accessing the Amity application. For further information about security please visit the security page.
Version 6 and Beta(v0.0.1)
Query for users by their display name, receiving a collection of AmityUser
matching your search. It requires two parameters: the display name you're searching for, and a 'sort option' from the AmityUserSortOption
enum. If no keyword is supplied, the list of users will be organized alphabetically by display name.
Users also have the option to sort by lastCreated
, firstCreated
, or displayName
. When a keyword is provided, the list will be arranged based on search rank. The displayName
sort option will be specified by default if it isn't specified.
If the collection is sorted by displayName
, the results will be alphabetically and case-sensitively ordered (aA-zZ). For example: adam, arthur, Alice, Andre, charlie, Kristen.
Note: If the user ID or display name you’re searching for contains special characters, you’ll need to enter the whole keyword in order for it to appear in the search results.
The code above will provide you with the list of users which matches with display name "Brian".
The above example searches for all users whose display names start with "Test User 1".
The queryUsers
provides a way to search for users by their display name.
Query for users to receive a collection of AmityUser
based on a single parameter: a 'sort option' from the AmityUserSortOption
enum. Sort the list by options such as displayName
, firstCreated
, or lastCreated
. The displayName
sort option will be specified by default if it isn't specified.
If you wish to observe for changes to a collection of users, you can use liveUsers
In the Amity SDK, a user is represented by an AmityUser
object, which contains the user's unique userId
and displayName
. The userId
is an immutable value that is assigned to a user when their account is created, and cannot be changed afterwards. This value serves as a unique identifier for the user within the SDK, and is used to perform actions such as sending messages or creating connections between users.
To retrieve an AmityUser
object for a specific userId
, you can use the getUser
method provided by the UserRepository
. This method accepts the userId
as a parameter and returns a Live Object of AmityUser
. The live object allows developers to observe changes to the user's properties in real-time, ensuring that their app remains up-to-date with the latest user information.
Follow the below code to retrieve a user object:
The User Repository provides a method to get a single user. It returns a LiveObject which you can observe.
You can also use the code below to get one user:
The User Repository provides a method to get a list of all users, which will be returned as a LiveCollection:
This method takes an optional sortBy
parameter which must be a UserSortingMethod
- these include displayName
, firstCreated
, and lastCreated
:
The functionality isn't currently supported by this SDK.
To retrieve multiple users, you can use getUserByIds
method provided by UserRepository
. This method accepts a collection of userId
as a parameter and returns a Live Collection ofAmityUser
.
The functionality isn't currently supported by this SDK.
The functionality isn't currently supported by this SDK.
The functionality isn't currently supported by this SDK.
AmityClient
class provides a method hasPermission
which allows you to check if the current logged in user has permission to do stuff in given channel.
We determine a user's moderation capabilities based on their current role. Amity SDK has the following default roles:
Member - has no moderation privileges
Community/Channel Moderator - can assert general moderation privileges on other users
Super Moderator - can assert general moderation privileges and be exempt from moderation from other users
Global Admin (Admin Only) - can assign the roles of others, assert all moderation privileges and be exempt from moderation
A user's role can be changed via Console. Refer to Moderation, Roles & Privileges for the instructions on how to change a user's role.
The Global Admin role cannot be assigned to a user.
Below are tables for each category that show the default roles and permissions. You can create new roles and assign a specific set of permissions for each role in the ASC Console. Refer to Moderation, Roles & Privileges.
Permission | Global Admin | Super Moderator | Community Moderator | Channel Moderator |
---|---|---|---|---|
*UserV3
*ChannelV3
*CommunityV3
There is no limit to the number of moderators in a community. If there are 100 members in the community, all 100 members can be promoted to moderator. Promoting a user to a community-level moderator can be done using the Update Role API or through the SDK.
Each role can be assigned with many permissions. Below is a list of all the possible permissions that can be assigned to a user.
Flag / Unflag User feature is an essential tool for maintaining a safe and engaging chat community. With Amity Social Cloud, you can use the flag and unflag user feature to allow moderators and administrators to monitor any inappropriate behavior within a chat channel.
In this section, we will discuss how to use the flag and unflag user feature of Amity Chat SDK to maintain a safe and engaging chat community.
To flag / unflag users on iOS, Android and Flutter SDK, create an instance of UserFlagger
first:
The UserFlagger
lets you flag and unflag a user. It also exposes an asynchronous way to check whether the current logged-in user has already flagged the given user or not.
To flag a user, call the following method:
To unflag a user, call the following method:
To check whether a user has been flagged by the current user:
Content-type | application/json |
---|
Path | Data field |
---|
Permission | Global Admin | Super Moderator | Community Moderator | Channel Moderator |
---|---|---|---|---|
Permission | Global Admin | Super Moderator | Community Moderator | Channel Moderator |
---|---|---|---|---|
Permission | Global Admin | Super Moderator | Community Moderator | Channel Moderator |
---|---|---|---|---|
ASC Console Access
✅
✅
❌
❌
Create, Edit, & Delete, Roles
✅
✅
✅
✅
Ban & Edit User*
✅
❌
❌
❌
Exempt from filters
✅
✅
❌
❌
Exempt from rate limits
✅
✅
❌
❌
Exempt from mute
✅
✅
❌
❌
Exempt from ban
✅
✅
❌
❌
Exempt from blacklist & whitelist
✅
✅
❌
❌
Exempt from repitition check
✅
✅
❌
❌
Edit, Ban, Add, Remove, & Mute Channel User *
✅
✅
❌
✅
Edit & Mute Channel*
✅
✅
❌
✅
Edit & Delete Message*
✅
✅
❌
✅
Edit Channel Rate Limit*
✅
❌
❌
❌
Ban, Mute, Rate limit, & Manage Users
✅
✅
❌
✅
Mute Channels
✅
✅
❌
✅
Rate Limit Channels
✅
✅
❌
✅
Manage Messages
✅
✅
❌
✅
Global Access
✅
✅
❌
❌
Create, delete, Edit Community Categories
✅
✅
✅
❌
Edit & Delete Communities*
✅
✅
✅
❌
Edit, Add, Ban, & Remove Community Users*
✅
✅
✅
❌
Edit, Delete, & Review Community Posts*
✅
✅
✅
❌
Edit & Delete Community Comments*
✅
✅
✅
❌
Manage Community
✅
✅
✅
❌
Manage Community Stories
✅
✅
✅
❌
Edit & Delete User Feed Post
✅
✅
✅
❌
Edit & Delete User Feed Comment
✅
✅
✅
❌
Manage Posts & Comments
✅
✅
✅
❌
Manage Network Settings
✅
✅
✅
✅
Source
Permission
Description
Channel
MUTE_CHANNEL
Can mute/unmute channel
CLOSE_CHANNEL
Can close channel
EDIT_CHANNEL
Can edit channel
EDIT_CHANNEL_RATELIMIT
Can set rate limit of channel
EDIT_MESSAGE
Can edit all messages
DELETE_MESSAGE
Can delete all messages
BAN_CHANNEL_USER
Can ban/unban user from channel
MUTE_CHANNEL_USER
Can mute/unmute user in channel
ADD_CHANNEL_USER
Can add users to channel
REMOVE_CHANNEL_USER
Can add remove user from channel
EDIT_CHANNEL_USER
Can edit users in channel
User
BAN_USER
Can global ban/unban user
EDIT_USER
Can edit users
ASSIGN_USER_ROLE
Can assign role to users
User feed
EDIT_USER_FEED_POST
Can edit all posts on user feed
DELETE_USER_FEED_POST
Can delete all posts in user feed
EDIT_USER_FEED_COMMENT
Can edit all comments on user feed
DELETE_USER_FEED_COMMENT
Can delete all comments in user feed
Community
ADD_COMMUNITY_USER
Can add users to community
REMOVE_COMMUNITY_USER
Can remove users from community
EDIT_COMMUNITY_USER
Can edit users in community
BAN_COMMUNITY_USER
Can ban users in community
MUTE_COMMUNITY_USER
Can mute users in community
EDIT_COMMUNITY
Can edit community
DELETE_COMMUNITY
Can delete community
EDIT_COMMUNITY_POST
Can edit all posts in community feed
DELETE_COMMUNITY_POST
Can delete all posts in community feed
EDIT_COMMUNITY_COMMENT
Can edit all comments in community feed
DELETE_COMMUNITY_COMMENT
Can delete all comments in community feed
REVIEW_COMMUNITY_POST
Can review community post
MANAGE_COMMUNITY_STORY
Can create and delete community story
Community Category
CREATE_COMMUNITY_CATEGORY
Can create new community categories
EDIT_COMMUNITY_CATEGORY
Can edit community categories
DELETE_COMMUNITY_CATEGORY
Can delete community categories
Network
CREATE_ROLE
Can create new roles
EDIT_ROLE
Can edit roles
DELETE_ROLE
Can delete roles
Notification
MANAGE_NOTIFICATION_NETWORK_SETTING
Can manage notification settings
Authorization | Bearer{{Admin Token}} |
UserID | User public id |