User object

User refers to a single user in a chat.

Properties

The User class has the following properties:

public class User : UniqueChatEntity {
public string Id { get; protected set; }
public string UserName { get; }
public string ExternalId { get; }
public string ProfileUrl { get; }
public string Email { get; }
public string CustomData { get; }
public string Status { get; }
public string DataType { get; }
public bool Active { get; }
public string LastActiveTimeStamp { get; }
}
ParameterDescription
Id
Type: string
Unique identifier for the user.
UserName
Type: string
Display name or username of the user.
ExternalId
Type: string
Identifier for the user from an external system, such as a database or CRM.
ProfileUrl
Type: string
URL to the user's profile or avatar image.
Email
Type: string
User's email address.
CustomData
Type: string
Any custom data that you want to store for the user.
Status
Type: string
Current status of the user (e.g., online, offline, away).
DataType
Type: string
Type of user's data.
Active
Type: bool
Returned info on whether the user is active (true) or not active (false) on the channel. The returned value depends strictly on how you configure your chat app during initialization - if you set the StoreUserActivityInterval parameter to the default 600000 milliseconds (10 minutes) and the user has been active in the app within the last 10 minutes (based on their LastActiveTimeStamp property), accessing the Active property returns true.
LastActiveTimeStamp
Type: string
Timestamp for the last time the user was active in a chat app.
API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

Events

The User object has the following event:

// Event triggered when the user is updated
public event Action<User> OnUserUpdated;

Example

An event that is triggered when the user is updated by the server.

user.OnUserUpdated += (user) =>
{
Console.WriteLine("User metadata updated!");
};

Methods

You can call the following methods on the User object. Click on each method for more details.

Use case

For example, you can use the User object methods to:

Last updated on