users.find()

Retrieves a User by ID, email or phone number.

Definition

client.users.find(
id: string, options: ?Object
):Promise<User,Error>

Parameters

ParameterTypeDescription
options?ObjectOptions (described below)

Options

One of organizationIds or organizationId may be provided. If neither is provided, an attempt will be made to deduce a list of organizations to query. Each will cause a user profile for that organization to be included in the response User object.

ParameterTypeDescription
organizationId?stringID of organization to query
organizationId?string[]IDs of organizations to query

Returns

Once the returned Promise is resolved, we will have access to a User object.

Examples

try {
const user = await client.users.find('some-user-id', {
organizationId: 'some-org-id'
});
console.log('found user', user.displayName);
} catch (err) {
if (err.code == client.errors.NotFoundError.code) {
console.log('User not found');
} else {
console.log('Error');
}
}