Manage user details

Get details about the app users.

Get user details

Return data about a specific user with the getUser() method.

By default, this method returns all custom user metadata without the need to define that during the call explicitly.

Requires App Context

To store data about users, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

icon

Under the hood


This method takes the following parameters:

chat.getUser(
id: string
): Promise<User | null>

Input

ParameterTypeRequiredDefaultDescription
idstringYesn/aUnique user identifier (up to 92 UTF-8 characters).

Output

TypeDescription
Promise<User> or Promise<null>Returned object containing the user metadata or a null value if the user doesn't exist.

Errors

If you try to fetch a user without providing their ID, you will receive the ID is required error.

Basic usage

Get details on user support_agent_15.

// reference the "chat" object and invoke the "getUser()" method
const user = await chat.getUser("support_agent_15")

Get current user

currentUser is a getter method that returns the current chat user of the chat app.

Requires App Context

To store data about users, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

This method has the following signature:

chat.currentUser: User

Properties

PropertyTypeDescription
currentUserUserReturned User object.

Basic usage

Return the current chat user.

chat.currentUser
Last updated on