Querying Users

LAST EDIT Jul 21 2021

The Query Users method allows you to search for users and see if they are online/offline. The example below shows how you can retrieve the details for 3 users in one API call:

Another option is to query for banned users. This can be done with the following code snippet:

An object with an array of users will be returned.

Please be aware that this query will return users banned across the entire app, not at a channel level.
All filters use a Mongoose style syntax; however, we do not run MongoDB on the backend, so you can only use a subset of queries that are normally available within Mongoose.

You can filter and sort on the custom fields you've set for your user, the user id, and when the user was last active.

The options for the queryUser method are presence, limit, and offset. If presence is true this makes sure you receive the user.presence.changed event when a user goes online or offline.

nametypedescriptiondefaultoptional
presencebooleanGet updates when the user goes offline/onlinefalse
limitintegerNumber of users to return30
offsetintegerOffset for pagination0
You can subscribe to presence status of at most 30 users using this method.
Note - The offset limit is set to 1000.

Querying Using the $autocomplete Operator

Copied!

You can autocomplete the results of your user query by username and/or ID.

1. By Custom Field

Copied!

If you want to return all users whose custom field 'name' has a value that includes 'ro', you could do so with the following:

This would return an array of any matching users, such as:

2. By ID

Copied!