Docs
/
In-App UI
React
Hooks
useMsTeamsConnectionStatus

useMsTeamsConnectionStatus

The useMsTeamsConnectionStatus hook is used to check and manage the current Microsoft Teams connection status for a user. This hook is typically used internally by the KnockMsTeamsProvider and is not commonly used directly in application code.

Parameters

#
knockKnockRequired

The authenticated Knock client instance.

knockMsTeamsChannelIdstringRequired

The Knock channel ID for the Microsoft Teams integration.

tenantIdstringRequired

The tenant ID for multi-tenant applications.

Returns

#

Returns an object with the following properties:

connectionStatusConnectionStatus

The current connection status: 'connecting' | 'connected' | 'disconnected' | 'error' | 'disconnecting'.

setConnectionStatus(status: ConnectionStatus) => void

Function to update the connection status.

errorLabelstring | null

Error message if the connection check failed.

setErrorLabel(errorLabel: string) => void

Function to set an error message.

actionLabelstring | null

Label for the current action being performed.

setActionLabel(actionLabel: string | null) => void

Function to set an action label.

Example

#

Basic usage

#

This hook is typically used internally by the KnockMsTeamsProvider. If you need to access the connection status in your components, use the useKnockMsTeamsClient hook instead:

Advanced usage

#

If you need to use this hook directly: