Help Needed: Unsolvable Google Chat File Upload - attachments:upload Fails with 400/404

Hello n8n Community,

I’ve been working on a complex Google Chat bot and have hit a complete wall on the final step. I’m hoping someone in the community has experience with this specific API call.

My Goal: I’m trying to build a workflow where my bot receives a message (text or audio), generates a response with the AI Agent, converts the AI’s text response into an audio file (using OpenAI TTS), and then sends that generated audio file back as a reply in Google Chat.

My Workflow Overview: The workflow correctly handles both text and audio inputs. The audio is transcribed, a response is generated by the AI Agent, and OpenAI successfully creates an .opus audio file as binary data within n8n. Everything works perfectly up to the final step of sending the reply.

The Problem: I cannot get the final HTTP Request node to successfully upload the generated audio file to Google Chat. I am using the documented two-step process (upload media, then create a message with the returned name), but the first “upload” step always fails with an error from Google’s servers.

Depending on the exact URL and configuration, I consistently get one of these two errors:

  • 404 Not Found - The resource you are requesting could not be found
  • 400 Bad Request - Missing or malformed space resource name in the request
  • 400 Bad Request - No file found in request

What I Have Already Tried (The Troubleshooting Journey):

I have spent many hours debugging this and have confirmed the following:

  • Authentication: My Chat OAuth2 API credential works perfectly. I can use it with a Google Chat node or an HTTP Request node to send text messages successfully.
  • Google Cloud Project: The Google Chat API is enabled . My OAuth Consent screen has the correct scopes (chat.messages , chat.spaces , chat.memberships ). My app is in “Testing” mode with my user correctly added as a Test User.
  • Google Workspace: My admin settings are configured to allow third-party app access.
  • API Endpoints: I have tried multiple variations of the upload URL based on Google’s documentation and community suggestions, including:
    • https://chat.googleapis.com/v1/media:upload
    • https://chat.googleapis.com/upload/v1/spaces/{spaceName}/attachments:upload
    • The same URL with a ?filename= query parameter.
  • Request Format: I have tried sending the file using the HTTP Request node with the Body Content Type set to both Binary Data and Form-Data (multipart/form-data) .
  • Multipart Payloads: I have tried building a multipart request with two parts as suggested by Google’s API requirements: a JSON metadata part and the binary file part.
  • Data Handling: I have used Merge , Set , and Code nodes to ensure that all necessary data (spaceName , the binary data property with a correct fileName ) is present and correctly formatted in the item that is fed into the final HTTP Request node. The errors persist even when hardcoding values like the spaceName .
  • n8n Limitations: I have encountered and worked around a source.on is not a function crash by using a Read/Write Files from Disk node to save the binary data before the upload attempt. The upload still fails even with this workaround.

My Question for the Community:

  1. Has anyone successfully used a custom HTTP Request node to upload a generated binary file to Google Chat? If so, could you share the correct node configuration?
  2. Is there a known bug or limitation in n8n v1.95.3 that would explain why the HTTP Request node fails to build this specific multipart/form-data request correctly?
  3. Is the consistent 404 / 400 error a known issue for Google Chat apps in “Testing” mode (i.e., does this feature only work for published marketplace apps)?

I have exhausted every possible troubleshooting step I can think of. Any insight or alternative methods the community might have would be incredibly appreciated.

Thank you!
Phil

Hi @pva2025 ,

Welcome to the community.

Thanks for sharing everything in detail.


It’s been 4 hrs since I read your post, and trying to find the exact solution and I am happy to share that I finally made it work…

So…

Here is the solution that allows you to upload any supported file to google chat.

Now it’s time to share some not-so-good news.

  • While I was working on your request, I managed to find a solution that technically works: you can send an audio file to a Google Chat space as an attachment.
  • However, after getting everything working, I realized that it’s not exactly what you were aiming for.
    – Your goal was to send an inline voice message, like this (screenshot below):
  • Unfortunately, the Google Chat API does not currently support sending inline audio messages. There’s no way (at least for now) to replicate the built-in voice message feature using the public API.
  • So yes — you can upload and send audio files, but they will appear as standard file attachments, like this:
    The user will have to download or open the file manually to listen to it — it won’t play inline inside the chat.

Hope this help!

Sudhanshu