For AI agents: this page in Markdown: https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/user.md. Documentation index: https://www.pubnub.com/llms-full.txt.
User object
User represents a single user in a chat.
Properties
User has the following properties:
1class User {
2 id: string,
3 name?: string,
4 externalId?: string,
5 profileUrl?: string,
6 email?: string,
7 custom?: ObjectCustom,
8 status?: string,
9 type?: string,
10 updated?: string,
11 lastActiveTimestamp?: number
12}
name#- Display name or username of the user (must not be empty or consist only of whitespace characters).
externalId#- Identifier for the user from an external system, such as a third-party authentication provider or a user directory.
profileUrl#- URL to the user's profile or avatar image.
email#- User's email address.
custom#- Any custom properties or metadata associated with the user in the form of a JSON. Values must be scalar only; arrays or objects are not supported. App Context filtering language doesn't support filtering by custom properties.
status#- Current status of the user, like
online,offline, oraway. type#- Type of the user, like
admin,member,guest. updated#- Timestamp (a number of seconds since January 1, 1970) for the last time the user information was updated or modified.
lastActiveTimestamp#- 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.
Methods
Available methods:
Regular methods
- (getter)
active delete()getChannelRestrictions()getChannelsRestrictions()getMembership()getMemberships()isMemberOf()isPresentOn()setRestrictions()update()wherePresent()
Event listeners
onDeleted()onInvited()onMentioned()onRestrictionChanged()onUpdated()(deprecated)streamUpdates()- (static)
streamUpdatesOn()
Use case
User methods enable:
- Creating and managing users
- Configuring channel memberships
- Mentioning others in conversations
- Checking user presence status