Google chat get messages in space

Hey there, I am struggling a lot with simple things in n8n. I managed to setup google credentials via service account and could get available spaces. As the google chat node is missing a method for getting messages in a space, I wanted to call the API directly using HTTP Request node in conjunction with google chat node custom operation. I did hit the toggle to allow the credentials to be used for http requests. Once I did that, n8n complains about secretOrPrivateKey must be an asymmetric key when using RS256. Without the toggle at least getting the space works.
Can someone please assist setting this up to let me call the api?
Btw, saving google credentials always stuck at the testing stage because of an exception Cannot read properties of undefined (reading 'googleApiCredentialTest'). Seem to be a bug in the latest docker image.
Btw2, without toggling the permission to use the credential for http requests I receive an error from the google api Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

It drives me crazy that all my plans to use n8n stuck at the integration of 3rdParty :frowning:

Please someone help me out^^

Hey @thomas.s

Sorry to hear that you face that much problem in just getting the messages in the space…

As you mentioned that you are able to authenticate yourself using service account…

I would say simple use this node and you’ll able to get all the messages in a space

and you can do all this directly using google chat node…

If you further still face any problem you can go through this tutorial.

1 Like

Funny how easy a workaround can be. Thank you very much for sharing.
In meanwhile I implemented a custom node but this one is way simpler^^

Thanks a lot

1 Like

Hey @thomas.s, I’m so happy it worked for you!

Yup, it’s simpler than your setup, but I remember how much time it took me to figure out the same thing… hahaha.

Since you’ve found your solution, I’d appreciate it if you could take a moment and mark the post as the solution…this will help others who might be trying to solve the same problem in the future. :->

Happy flowgramming, my friend!

2 Likes

FYI: A restriction is the endpoint is paginated, the very simple solution does not support this. It also doesn’t support sorting. So very large threads >100 messages will not be complete. Still a nice and simple solution.

In regards to marking as solved, I don’t see the option yet, likely due to me being new in this forum.

Hi! In this video, you used the Manual Execution Trigger. How can we set it up so that the trigger is a message received from Google Chat, given that there isn’t a built-in trigger node for incoming Google Chat messages?

1 Like

Hi @Sudhanshu_Sharma

I’ve watched your videos and appreciate it.

I just would like get some help as im trying to create a Google chat app with either a apps script or http node.

The goal is that I want to be able to send and receive message from n8n.

I can recieve messages so far with the help appscript and it only works when using @mention. But my problem is I want to have the app to send all the messages to my webhook. I also tried the dm to app but I can’t respond to dm via the webhook or any means if you can help me I would be very great ful

1 Like

Hey @Ahmad_Yar, thanks for pointing this out. I have created a new tutorial in which I explain the same thing.

You will be able to chat with the application directly via DM.

1 Like

Hey @FSFHM , you can follow this video.

Here I have explained how you can

  • Setup webhook in n8n to receive Google Chat messages
  • Creating bidirectional communication between Google Chat and n8n

This supports both space as well as DM…i.e you will be able to chat with the AI agent inside the space as well as in DM (Directly to the application)

2 Likes
ChatGPT said:

Thank you so much for your explanation, you’re really amazing!

1 Like

You’re Welcome :blush:

1 Like

I have a question: Is it possible to read messages sent to a Google Chat space (not in direct messages) without mentioning the bot?

No, that is not possible.

1 Like

From API perspective this is possible. You need either a service account with domain wide delegation or use Oauth2 with a user who has joined the corresponding space.
I do use the Oauth2 approach with a custom node which implements the get message list operation.
Downside of Oauth2 approach is that you won’t get deplay names of users but only their id (its called name in googles API).

1 Like