Docs
/
In-App UI
React
Hooks
useConnectedMsTeamsChannels

useConnectedMsTeamsChannels

The useConnectedMsTeamsChannels hook is used to retrieve and manage Microsoft Teams channels that are currently connected for a specific recipient object. This hook must be used within a KnockMsTeamsProvider.

Parameters

#

Accepts an object with the following properties:

msTeamsChannelsRecipientObjectRecipientObjectRequired

The recipient object (with objectId and collection) to get connected channels for.

Returns

#

Returns an object with the following properties:

dataMsTeamsChannelConnection[] | null

Array of connected Microsoft Teams channels for the recipient object.

updateConnectedChannels(channels: MsTeamsChannelConnection[]) => Promise<void>

Function to update the connected channels for the recipient object.

loadingboolean

Whether connected channels are being loaded or revalidating.

errorstring | null

Error message if the request failed.

updatingboolean

Whether an update operation is in progress.

Example

#

Basic usage

#

The following example demonstrates how to use the useConnectedMsTeamsChannels hook to display and manage connected Microsoft Teams channels.

Updating connected channels

#

You can add or update connected channels by calling updateConnectedChannels with the new array: