'retrieve messages from google chat to a google sheet

I am trying to extract google chat threads from spaces in which there are standard messages like: Help - Case 123456 what i would like to do is to export that data to a google sheet and also include the names of the user who started the thread and or commented, only messages from today from specific space, i know how to send messages to google chat via api rest by following the doc but i cant find a way to retrieve data, i can't seem to understand how to do it via webhooks, any thoughts? i will be heartly thankful if anyone could help me with this.

from json import dumps

from httplib2 import Http


def main():
    """Hangouts Chat incoming webhook quickstart."""
    url = '<INCOMING-WEBHOOK-URL>'
    bot_message = {
        'text' : 'Hello from a Python script!'}

    message_headers = {'Content-Type': 'application/json; charset=UTF-8'}

    http_obj = Http()

    response = http_obj.request(
        uri=url,
        method='POST',
        headers=message_headers,
        body=dumps(bot_message),
    )

    print(response)

if __name__ == '__main__':
    main()


Solution 1:[1]

Unfortunately there's no way to retrieve messages from a chat using the API.

If you think of it as a good feature, you can fill out a Feature Request on https://developers.google.com/chat/support#missing_features

As I can see, there are other developers requesting the same feature, so it's most likely Google is working on that, since the API is relatively new

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Salomon