Manage user details

Retrieve user details from your app.

Get user details​

getUser() returns data about a specific user, including all custom metadata by default.

Requires App Context

Enable App Context in the Admin Portal to store user data.

Method signature​

icon

Under the hood


This method takes the following parameters:

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

Input​

* required
ParameterDescription
id *
Type: string
Default:
n/a
Unique 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.

Sample code​

Get details on user support_agent_15.

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

Get current user​

currentUser returns the current chat user.

Requires App Context

Enable App Context in the Admin Portal to store user data.

Method signature​

This method has the following signature:

1chat.currentUser: User

Properties​

PropertyDescription
currentUser
Type: User
Returned User object.

Sample code​

Return the current chat user.

1chat.currentUser

Was this page useful?

Last updated on