Get Google Chat Direct Messages with Google Apps Script

36 Views Asked by At

Amateur coder here,

I would like to make a function with Google Apps Script which monitors my Google Chat Direct Messages and uploads them into a sheet. The problem is that it seems there is no method to do such thing, at least I always bump into barriers no matter what I try...

  • GPT suggested the getChatThreads() method but it's not working and actually it has been deprecated.
  • I tried to use the GmailApp.search(query) method but it only detects emails. Even using the 'in:chats' or 'is:chat' filters the query does not fetch anything, it seems it does not recognize chats/conversations.
  • I found suggestions for using 'webhooks' but unfortunately I can't use that as it is blocked by group policy.
  • The other options I found are related to Chat Spaces. If the conversation is in a Chat Space, there are maybe some methods to get the messages if the Space ID is known. My problem is that I want to get my Direct Messages which are not categorized into Spaces. Also, it can happen that someone creates a new Space and in this case the ID is not known in advance.

So my question again: Is there any way to make a gscript function which runs periodically, monitors new Google Chat messages (in Chat Spaces and DMs) and uploads them into a sheet?

Any other alternative solutions are welcomed.

0

There are 0 best solutions below