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

*************
list_channels
*************



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

  

  Lists all Channels created under a single Chime App as a paginated list. You can specify filters to narrow results.

   

  **Functionality & restrictions**

   

  
  * Use privacy = ``PUBLIC`` to retrieve all public channels in the account.
   
  * Only an ``AppInstanceAdmin`` can set privacy = ``PRIVATE`` to list the private channels in an account.
  

   

  .. note::

    

    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.

    

  

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


  **Request Syntax**
  ::

    response = client.list_channels(
        AppInstanceArn='string',
        Privacy='PUBLIC'|'PRIVATE',
        MaxResults=123,
        NextToken='string',
        ChimeBearer='string'
    )
    
  :type AppInstanceArn: string
  :param AppInstanceArn: **[REQUIRED]** 

    The ARN of the ``AppInstance``.

    

  
  :type Privacy: string
  :param Privacy: 

    The privacy setting. ``PUBLIC`` retrieves all the public channels. ``PRIVATE`` retrieves private channels. Only an ``AppInstanceAdmin`` can retrieve private channels.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of channels that you want to return.

    

  
  :type NextToken: string
  :param NextToken: 

    The token passed by previous API calls until all requested channels are returned.

    

  
  :type ChimeBearer: string
  :param ChimeBearer: **[REQUIRED]** 

    The ARN of the ``AppInstanceUser`` or ``AppInstanceBot`` that makes the API call.

    

  
  
  :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) --* 

        The information about each channel.

        
        

        - *(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 requests 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`

  