WorkspaceUsersClient
Client for /api/v1.0/workspace_users/. The backend's add endpoint
rejects non-empty name and channelIds — set neither.
Extends
BaseClient
Constructors
Constructor
new WorkspaceUsersClient(config: ClientConfig): WorkspaceUsersClient;
Parameters
| Parameter | Type |
|---|---|
config | ClientConfig |
Returns
WorkspaceUsersClient
Inherited from
BaseClient.constructor
Properties
| Property | Modifier | Type |
|---|---|---|
apiToken | readonly | string |
baseUrl? | readonly | string |
customFetch? | readonly | CustomFetch |
defaultVersion | readonly | "v1.0" |
headers? | readonly | CustomHeaders |
Methods
addUser()
addUser(args: {
email: string;
userType?: "USER" | "GUEST" | "ADMIN";
workspaceId: number;
}): Promise<{
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ... | ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ... | ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}>;
Adds a person to a workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { email: string; userType?: "USER" | "GUEST" | "ADMIN"; workspaceId: number; } | The arguments for adding a user. |
args.email | string | The user's email. |
args.userType? | "USER" | "GUEST" | "ADMIN" | Optional user type (USER, GUEST, or ADMIN). |
args.workspaceId | number | The workspace ID. |
Returns
Promise<{
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ... | ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ... | ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}>
The created workspace user object.
getBaseUri()
protected getBaseUri(): string;
Returns the base URI for an API request, with a guaranteed trailing
slash so relative paths resolve cleanly through URL.
Returns
string
Inherited from
BaseClient.getBaseUri
getLinkBaseUrl()
protected getLinkBaseUrl(): string | undefined;
Base URL for entity web links, or undefined to use getFullCommsURL's
default web app. Trailing-slash normalization happens in
getFullCommsURL, so the configured value is returned verbatim.
Returns
string | undefined
Inherited from
BaseClient.getLinkBaseUrl
getUserByEmail()
getUserByEmail(args: GetUserByEmailArgs): Promise<
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted: true;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
version: number;
}>;
Gets a user by email.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetUserByEmailArgs | The arguments for getting a user by email. |
Returns
Promise<
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted: true;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
version: number;
}>
The workspace user object, reduced to the restricted shape when the viewer may not see the user's full profile.
Example
const user = await api.workspaceUsers.getUserByEmail({
workspaceId: 123,
email: 'user@example.com',
})
getUserById()
getUserById(args: GetUserByIdArgs): Promise<
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted: true;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
version: number;
}>;
Gets a user by id.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetUserByIdArgs | The arguments for getting a user by ID. |
Returns
Promise<
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted: true;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
version: number;
}>
The workspace user object, reduced to the restricted shape when the viewer may not see the user's full profile.
Example
const user = await api.workspaceUsers.getUserById({ workspaceId: 123, userId: 456 })
console.log(user.fullName, isRestrictedWorkspaceUser(user) ? null : user.email)
getUserInfo()
getUserInfo(args: GetUserInfoArgs): Promise<Record<string, unknown>>;
Gets the user's info in the context of the workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetUserInfoArgs | The arguments for getting user info. |
Returns
Promise<Record<string, unknown>>
Information about the user in the workspace context.
getUserLocalTime()
getUserLocalTime(args: GetUserLocalTimeArgs): Promise<string>;
Gets the user's local time (e.g., "2017-05-10 07:55:40").
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetUserLocalTimeArgs | The arguments for getting user local time. |
Returns
Promise<string>
The user's local time as a string.
Example
const localTime = await api.workspaceUsers.getUserLocalTime({
workspaceId: 123,
userId: 456,
})
console.log('User local time:', localTime)
getUsersByIds()
getUsersByIds(args: GetUsersByIdsArgs): Promise<Record<number,
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: ... | ...;
};
pauseNotifications?: {
scope?: ... | ...;
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted: true;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: ... | ...;
};
pauseNotifications?: {
scope?: ... | ...;
};
};
emoji?: string | null;
message?: string | null;
}
| null;
version: number;
}
| null>>;
Gets several users by id, one request per 100 ids. Prefer it over calling getUserById once per user.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetUsersByIdsArgs | The arguments for getting users by ID. |
Returns
Promise<Record<number,
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: ... | ...;
};
pauseNotifications?: {
scope?: ... | ...;
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}
| {
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted: true;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: ... | ...;
};
pauseNotifications?: {
scope?: ... | ...;
};
};
emoji?: string | null;
message?: string | null;
}
| null;
version: number;
}
| null>>
The users keyed by id, each reduced to the restricted shape when
the viewer may not see the full profile. An id the workspace has no record
of maps to null, where getUserById would fail.
Throws
If any request fails, discarding the users already loaded.
Example
const users = await api.workspaceUsers.getUsersByIds({ workspaceId: 123, userIds: [456, 789] })
console.log(users[456]?.fullName ?? 'Unknown user')
getWorkspaceUserIds()
getWorkspaceUserIds(workspaceId: number): Promise<number[]>;
Returns a list of workspace user IDs for the given workspace id.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | number | The workspace ID. |
Returns
Promise<number[]>
An array of user IDs.
getWorkspaceUsers()
getWorkspaceUsers(args: GetWorkspaceUsersArgs): Promise<{
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}[]>;
Returns a list of workspace user objects for the given workspace id.
Removed users are excluded by default; set args.includeRemoved to true to include them.
The Comms API always returns removed users, so the filtering happens client-side.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetWorkspaceUsersArgs | The arguments for getting workspace users. |
Returns
Promise<{
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}[]>
An array of workspace user objects.
Example
const users = await api.workspaceUsers.getWorkspaceUsers({ workspaceId: 123 })
users.forEach(u => console.log(u.fullName, u.userType))
removeUser()
removeUser(args: {
email?: string;
userId?: number;
workspaceId: number;
}): Promise<void>;
Removes a person from a workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { email?: string; userId?: number; workspaceId: number; } | The arguments for removing a user. |
args.email? | string | Optional email of the user to remove. |
args.userId? | number | Optional user ID to remove (use either email or userId). |
args.workspaceId | number | The workspace ID. |
Returns
Promise<void>
resendInvite()
resendInvite(args: {
email: string;
userId?: number;
workspaceId: number;
}): Promise<void>;
Sends a new workspace invitation to the selected user.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { email: string; userId?: number; workspaceId: number; } | The arguments for resending an invite. |
args.email | string | The user's email. |
args.userId? | number | Optional user ID. |
args.workspaceId | number | The workspace ID. |
Returns
Promise<void>
updateUser()
updateUser(args: {
email?: string;
userId?: number;
userType: "USER" | "GUEST" | "ADMIN";
workspaceId: number;
}): Promise<{
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ... | ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ... | ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}>;
Updates a person in a workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { email?: string; userId?: number; userType: "USER" | "GUEST" | "ADMIN"; workspaceId: number; } | The arguments for updating a user. |
args.email? | string | Optional email of the user to update. |
args.userId? | number | Optional user ID to update (use either email or userId). |
args.userType | "USER" | "GUEST" | "ADMIN" | The user type (USER, GUEST, or ADMIN). |
args.workspaceId | number | The workspace ID. |
Returns
Promise<{
avatarUrls?: | {
s195: string;
s35: string;
s60: string;
s640: string;
}
| null;
dateFormat?: string | null;
email?: string | null;
firstName?: string | null;
fullName: string;
id: number;
imageId?: string | null;
removed: boolean;
restricted?: boolean | null;
setupPending?: boolean | null;
shortName: string;
status?: | {
activeUntil?: string | null;
effects?: {
pauseActivity?: {
scope?: {
mode?: ... | ...;
};
};
pauseNotifications?: {
scope?: {
mode?: ... | ...;
};
};
};
emoji?: string | null;
message?: string | null;
}
| null;
theme?: number | null;
timeFormat?: string | null;
timezone: string;
userType: "USER" | "GUEST" | "ADMIN";
version: number;
}>
The updated workspace user object.