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: