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 Trigger → If (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 IDexpression 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
}
}
}