Telegram Node 'Get a file' Fails with 'Invalid file_id' Error for Voice Messages

Hello n8n Community,

I am having a persistent issue with the Telegram “Get a file” node and would appreciate any help.

My Goal:
I am building a workflow to process messages from a Telegram bot. It should handle text messages and voice messages separately. For voice messages, the goal is to download the audio file and send it to OpenAI for transcription.

The Problem:
My workflow correctly identifies voice messages and routes them to the “Get a file” node. However, this node consistently fails with the error: “Bad Request: Invalid file_id”. This happens on live executions, so the file_id should be fresh and not expired.

My Setup:

  • n8n Version: 1.110.1
  • Deployment: Docker on a local machine
  • Webhook: Using ngrok for the URL

Workflow and Expressions:
The workflow logic is: Telegram TriggerIf (checks for voice/audio)Get a file.

  • The If node condition is: ={{$json.message.voice?.file_id || $json.message.audio?.file_id}} - Is Not Empty. This works correctly.
  • The “Get a file” node’s File ID expression is: ={{ $('Telegram Trigger').item.json.message.voice?.file_id || $('Telegram Trigger').item.json.message.audio?.file_id }}

What I’ve Confirmed:
The workflow routes correctly, and the “Get a file” node receives the correct input data. I have checked the JSON output of the trigger, and it clearly contains the voice object and the file_id.

Here is a sample of the input data received by the “Get a file” node from a live execution:

{
  "message": {
    "message_id": 19,
    "from": {
      "id": 7582817665,
      "is_bot": false,
      "first_name": ".",
      "language_code": "en"
    },
    "chat": {
      "id": 7582817665,
      "first_name": ".",
      "type": "private"
    },
    "date": 1757652499,
    "voice": {
      "duration": 8,
      "mime_type": "audio/ogg",
      "file_id": "AwACAgQAAxkBAAMZ...",
      "file_unique_id": "AgADZ...",
      "file_size": 33286
    }
  }
}

hello @abedmohamed258

Seems everything is set correctly. Please, share the workflow.

You can select all nodes with ctrl+a, copy it with ctrl+c. Then past the content here after pressing button </> with ctrl+v.

See if this helps you. This is how implemented a similar bot using either text or voice.

Oh VERY IMPORTANT, usually when I run into the error you get, it is because I have more than one telegram account setup, and in the receive message telegram node I have the right account, but then in the Get file node for telegram it sometimes defaults to one of the other connections, causing that error, meaning you are getting a file id from account 1 but trying to download the audio file from account 2 which wont exist of course. Make sure you have the exact same accounts selected in all telegram nodes for your workflow. n8n selects the first connection in the list.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.