Google Chat Error

Trying to use Google Chat and getting an error

ERROR: The resource you are requesting could not be found

After enabling Google Chat API for your GCP project, you need to configure your app on GCP in order to use Chat APIs

Please share the workflow

I followed the help topic and looked at community workflows for examples. The service account auth works, BUT cannot post a message or interact with the API which is enabled in the Google cloud console

Share the output returned by the last node

{“message”:“404 - {"error":{"code":404,"message":"After enabling Google Chat API for your GCP project, you need to configure your app on GCP in order to use Chat APIs","status":"NOT_FOUND"}}”,“name”:“Error”,“stack”:“Error: Request failed with status code 404\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)”}

Information on your n8n setup

Latest n8n - Docker compose setup - followed the instructions to the letter using sqlite db

Followed these instructions
https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlechat/
and then set up a Service account (that is the only one that is supported for Chat) from Google - n8n Documentation
The credentials work.
I see API calls made in the Goggle Cloud Console
BUT it appears I am missing an undocumented step in this process.
I see some people in the community chats have got this working.
Asana and Google Chat not coexisting

What did I miss?
Do I need to create an APP on GCP as the error message suggests?

Thanks

Hey @treyr,

It should be a case of making sure the app you have created in Google has permission to use the Chat APIs.

Thanks Jon - the instructions I linked to do not mention any app creation - do you have anything related to that please?

Hey @treyr,

It is a bit hidden but this is the bit you are after: Google - n8n Documentation

It is the same for all the Google apps you would need to enable them one by one.

Thanks Jon,
I reread the page - saw the video end to end again.
I have enabled the Chat API.
The account can access the API because I see calls being made using the stats graphs on the google console.
But I have NOT created any APPs on GCP - I believe that is the missing piece.
See below please

I went ahead and “configured” the screen I had pasted above and now I am getting a different error

ERROR: Forbidden - perhaps check your credentials?

This space doesn't support Chat apps; This Chat app is not a member of this space

I am not sure if I am headed in the right direction or making things worse?

Hey @treyr,

That looks like it might be better, the downside now is I have never used Google Chat. That error seems to suggest that maybe the app made in the google console doesn’t have access to the chat so will need to be added.

I finally got this working - took almost the whole day.
The bottom line is that the n8n documents and instructions I referenced above are incomplete - a huge part about configuring the Chat API on Google Cloud Console is completely missing.
None of this information is in the community posts or on online sources.

I would be happy to provide the material that could go into completing the documentation - would that be something of interest or should I just post those instructions in this thread for now?

1 Like

Hey @treyr,

With Google it is a bit tricky and we do make a lot of assumptions. I think improving the docs is always worth doing, if you felt up to it you can open a pull request on our docs site or just post your findings here and I can open an internal ticket.

1 Like

Updating this documentation Google - n8n Documentation

Using Service Account#

From your Google Cloud Console dashboard:

  1. Click on the hamburger menu and select APIs & Services > Credentials.
  2. Click on + CREATE CREDENTIALS and select Service account.
  3. Enter a name in the Service account name field.
  4. Click on the CREATE button.
  5. Based on your use-case, you may want to Select a role and Grant users access to this service account using the corresponding sections.
  6. Click Done.
  7. Select your newly created service account under the Service Accounts section and open the Keys tab.
  8. Click on ADD KEY and select Create new key.
  9. In the modal that appears, select JSON and click Create. n8n saves the file to your computer.

From you n8n instance:

  1. Enter a Credentials Name.
  2. In the Service Account Email field, enter the email associated with your new Service Account (visible in the Details tab).
  3. Enter the Private Key from the downloaded JSON file. If you are running an n8n version older than 0.156.0: replace all instances of \n in the JSON file with new lines.
  4. Optional: Click the toggle to enable Impersonate a User and enter the desired email.
  5. Save your credentials.

Now you must enable each Google service API that you want to use.

The following video demonstrates the steps mentioned above.

Enable APIs#

To enable an API, follow the steps below:

  1. Access your Google Cloud Console.
  2. From the hamburger menu select APIs & Services > Library.
  3. Search for and select the API(s) you want to enable.
  4. Click on the ENABLE button.

Google Chat Configuration

In the same chat API screen - click on the tab called Configuration
Fill in the details - the input values will be what you will refer to when you add this “app” to any Google Chat workspace

The App Name is the “App” you will be finding for and adding in Google Chat
The Avatar URL has to be any logo image

Further down check these settings

The App URL is not really relevant to sending messages but best to give it any https URL that you control
Finally in the permissions section - you can allow your whole domain to have access or restrict it to some people only.

Save the configuration.

Testing and using the App/Bot in Google Chat

To test in Google Chat - first start a 1:1 conversation with the bot to make sure it is accessible (sometimes it takes a few minutes for the bot to show up after you hit the Save above

** :warning:** Important - When you chat with the app/bot or add the app/bot to a Space, type in all the characters of the name. In the above example the App/Bot was named n8nbot.
If you just type n8n, the autocomplete will NOT show you the app at all - just keep typing n8nbot and then you will see it

Create a new space to test

It is s good idea to use a test space. The space (probably) need to allow people outside the org to join

Then add the app to this space

How to use this app in a n8n Node

Finally to use n8n to send messages to this space get the space identifier using this method
image

Add a new webhook - it doesn’t matter what it is called - it is not being used for anything
The section
spaces/AAAA_41A_L4 (no slash at the end)
is the value to be used in the n8n node to send a message like this

1 Like

I just added the instructions below - please update the docs when you can.
Thanks

Very nice thanks, I will get an internal ticket opened Monday morning for it.

1 Like