In-App UI
React
Hooks
useSlackChannels
useSlackChannels
The useSlackChannels hook is used to retrieve available Slack channels for a connected workspace. This hook must be used within a KnockSlackProvider.
Parameters
#Accepts an object with the following properties:
queryOptionsSlackChannelQueryOptions
Optional query options for filtering and pagination. Includes limitPerPage, types, and cursor.
Returns
#Returns an object with the following properties:
dataSlackChannel[]
Array of available Slack channels.
isLoadingboolean
Whether channels are being loaded or revalidating.
refetch() => void
Function to manually refetch the channels.
Example
#Basic usage
#The following example demonstrates how to use the useSlackChannels hook to display available Slack channels.
With query options
#You can customize the query with pagination and filtering options: