Do Not Disturb on the JS SDK

This guide explains how Do Not Disturb functionality works on the JS SDK.

Auto Forward Replies

When the current user sends to a recipient that has a Do Not Disturb Auto-Forward Recipient configured, whether in the context of a one-on-one conversation or a group conversation, a message will be sent back to the current user informing them of this.

For the time being, this message is temporary and will disappear when logging out or changing conversations. It is planned in the future to have these messages persist in conversations, just like other kinds of messages.


Configuring Do Not Disturb on a User

The client.users.update() method allows you to enable or disable Do Not Disturb (DND) and other preferences for the current user.

Definition

client.users.update({
displayName: ?string,
dnd: ?bool,
dndText: ?string,
}):Promise<User,Error>

Parameters

ParameterTypeDescription
displayName?stringUser's display name
dnd?boolIndicates whether dnd is enabled or disabled
dndText?stringAn auto-reply message to send whenever someone first tries to contact the current user

Returns

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

Example

const user = await client.users.update({
displayName: 'some-display-id',
dnd: true,
dndText: 'I\'m away right now'
});
console.log(
user.displayName, 'dnd is', user.dnd ? 'enabled' : 'disabled',
'with auto-reply message', user.dndText
);

Configuring Do Not Disturb Auto-Forward Recipient on a User

When do not disturb is enabled, we can use the client.users.setAutoForward() method to assign an auto forward recipient for an organization. The method returns true if the user was successfully set as an auto forward recipient.

We can use client.users.removeAutoForward() to disable the auto forward feature for an organization.

Definition

client.users.setAutoForward(
organizationId: string,
receiverId: string,
):Promise<boolean,Error>

Parameters

ParameterTypeDescription
organizationIdstringOrganization which will receive an auto forward recipient
receiverIdstringUser ID for the auto forward recipient

Example

await client.users.setAutoForward({
organizationId: 'some-organization-id',
receiverId: 'some-user-id'
});

Configuring Do Not Disturb with Automatic Response on a Role

This functionality is not yet available in the JS SDK; please contact your TigerConnect representative if you are interested in being able to set Do Not Disturb on roles.