:doc:`ChimeSDKMessaging <../../chime-sdk-messaging>` / Client / search_channels

***************
search_channels
***************



.. py:method:: ChimeSDKMessaging.Client.search_channels(**kwargs)

  

  Allows the ``ChimeBearer`` to search channels by channel members. Users or bots can search across the channels that they belong to. Users in the ``AppInstanceAdmin`` role can search across all channels.

   

  The ``x-amz-chime-bearer`` request header is mandatory. Use the ARN of the ``AppInstanceUser`` or ``AppInstanceBot`` that makes the API call as the value in the header.

   

  .. note::

    

    This operation isn't supported for ``AppInstanceUsers`` with a large number of memberships.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/chime-sdk-messaging-2021-05-15/SearchChannels>`_  


  **Request Syntax**
  ::

    response = client.search_channels(
        ChimeBearer='string',
        Fields=[
            {
                'Key': 'MEMBERS',
                'Values': [
                    'string',
                ],
                'Operator': 'EQUALS'|'INCLUDES'
            },
        ],
        MaxResults=123,
        NextToken='string'
    )
    
  :type ChimeBearer: string
  :param ChimeBearer: 

    The ``AppInstanceUserArn`` of the user making the API call.

    

  
  :type Fields: list
  :param Fields: **[REQUIRED]** 

    A list of the ``Field`` objects in the channel being searched.

    

  
    - *(dict) --* 

      A ``Field`` of the channel that you want to search.

       

      .. note::

        

        This operation isn't supported for ``AppInstanceUsers`` with a large number of memberships.

        

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        An ``enum`` value that indicates the key to search the channel on. ``MEMBERS`` allows you to search channels based on memberships. You can use it with the ``EQUALS`` operator to get channels whose memberships are equal to the specified values, and with the ``INCLUDES`` operator to get channels whose memberships include the specified values.

        

      
      - **Values** *(list) --* **[REQUIRED]** 

        The values that you want to search for, a list of strings. The values must be ``AppInstanceUserArns`` specified as a list of strings.

         

        .. note::

          

          This operation isn't supported for ``AppInstanceUsers`` with a large number of memberships.

          

        

      
        - *(string) --* 

        
    
      - **Operator** *(string) --* **[REQUIRED]** 

        The operator used to compare field values, currently ``EQUALS`` or ``INCLUDES``. Use the ``EQUALS`` operator to find channels whose memberships equal the specified values. Use the ``INCLUDES`` operator to find channels whose memberships include the specified values.

        

      
    

  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of channels that you want returned.

    

  
  :type NextToken: string
  :param NextToken: 

    The token returned from previous API requests until the number of channels is reached.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Channels': [
              {
                  'Name': 'string',
                  'ChannelArn': 'string',
                  'Mode': 'UNRESTRICTED'|'RESTRICTED',
                  'Privacy': 'PUBLIC'|'PRIVATE',
                  'Metadata': 'string',
                  'LastMessageTimestamp': datetime(2015, 1, 1)
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Channels** *(list) --* 

        A list of the channels in the request.

        
        

        - *(dict) --* 

          Summary of the details of a ``Channel``.

          
          

          - **Name** *(string) --* 

            The name of the channel.

            
          

          - **ChannelArn** *(string) --* 

            The ARN of the channel.

            
          

          - **Mode** *(string) --* 

            The mode of the channel.

            
          

          - **Privacy** *(string) --* 

            The privacy setting of the channel.

            
          

          - **Metadata** *(string) --* 

            The metadata of the channel.

            
          

          - **LastMessageTimestamp** *(datetime) --* 

            The time at which the last persistent message visible to the caller in a channel was sent.

            
      
    
      

      - **NextToken** *(string) --* 

        The token returned from previous API responses until the number of channels is reached.

        
  
  **Exceptions**
  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.BadRequestException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ForbiddenException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.UnauthorizedClientException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ThrottledClientException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ServiceFailureException`

  