List sections

This guide explains how to use the list method on the Section resource of the Google Chat API to list sections available to the authenticated user in Google Chat.

For more information, see Create and organize sections in Google Chat.

Prerequisites

Python

List sections

To list sections with user authentication, pass the following in your request:

  • Specify the chat.users.sections or chat.users.sections.readonly authorization scope.
  • Call the ListSections method.
  • Set parent to users/me.

The following example lists sections:

Python

fromgoogle.cloudimport chat_v1
deflist_sections():
 # Create a client
 client = chat_v1.ChatServiceClient()
 # Initialize request
 request = chat_v1.ListSectionsRequest(
 parent="users/me"
 )
 # Make the request
 page_result = client.list_sections(request=request)
 # Handle the response
 for section in page_result:
 print(section)

The Chat API returns a list of Section resources.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年04月20日 UTC.