Send a avi video file on Telegram

Describe the problem/error/question

I am trying to send a .avi video file to Telegram using an attachment from an email.
I can get it to work with a picture file but not with a document file.
I get the below error:

“400 - {“ok”:false,“error_code”:400,“description”:“Bad Request: wrong remote file identifier specified: can’t unserialize it. Wrong last symbol”} - Bad Request: wrong remote file identifier specified: can’t unserialize it. Wrong last symbol”

The Node API error is below:
“NodeApiError: Bad request - please check your parameters
at Object.apiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Telegram/GenericFunctions.js:107:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Telegram/Telegram.node.js:1714:36)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:670:19)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:652:53”

Please share your workflow

</{
“parameters”: {
“operation”: “getAll”,
“filtersUI”: {
“values”: {
“filters”: {
“readStatus”: “unread”
}
}
},
“options”: {
“downloadAttachments”: true
}
},
“id”: “5b744480-c8cc-4fc0-80ba-75d3cb129c0e”,
“name”: “Fetch unread messages with attachement”,
“type”: “n8n-nodes-base.microsoftOutlook”,
“typeVersion”: 2,
“position”: [
240,
560
],
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “pTeTBZLA3qyYU74A”,
“name”: “[email protected]
}
}
},
{
“parameters”: {
“operation”: “update”,
“messageId”: {
“__rl”: true,
“value”: “={{ $json.id }}”,
“mode”: “id”
},
“updateFields”: {
“isRead”: true
}
},
“id”: “82083a76-bdd8-41f6-8b9c-a571b53ae1e7”,
“name”: “Mark message as read”,
“type”: “n8n-nodes-base.microsoftOutlook”,
“typeVersion”: 2,
“position”: [
460,
460
],
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “pTeTBZLA3qyYU74A”,
“name”: “[email protected]
}
}
},
{
“parameters”: {
“jsCode”: “let results = ;\n\nfor (item of $input.all()) {\n for (key of Object.keys(item.binary)) {\n let modifiedItem = {\n json: item.json,\n binary: {\n data: item.binary[key],\n }\n };\n\n // Update the Mime Type to "media/document"\n modifiedItem.binary.data.mimeType = "video/x-msvideo";\n\n results.push(modifiedItem);\n }\n}\n\nreturn results;”
},
“id”: “255ae847-f8b3-4e84-8772-e2dfb9e1abd6”,
“name”: “Split out attachments”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
460,
660
]
},
{
“parameters”: {
“rule”: {
“interval”: [
{
“field”: “minutes”,
“minutesInterval”: 1
}
]
}
},
“id”: “d5741f98-e8ba-47fd-bdfb-ae1f31e6b754”,
“name”: “Schedule Trigger”,
“type”: “n8n-nodes-base.scheduleTrigger”,
“typeVersion”: 1.1,
“position”: [
60,
560
]
},
{
“parameters”: {
“operation”: “sendDocument”,
“chatId”: “-1002090795915”,
“file”: “data”,
“additionalFields”: {}
},
“id”: “7f2adcf9-baf5-4923-9d30-0431a7cbe0ce”,
“name”: “Telegram”,
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.1,
“position”: [
1200,
660
],
“credentials”: {
“telegramApi”: {
“id”: “Cdr63nuUK8XZYTHe”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“conditions”: {
“string”: [
{
“value1”: “={{ $binary.data.mimeType }}”,
“operation”: “startsWith”,
“value2”: “video”
}
]
}
},
“id”: “ec1163d0-e584-465f-94ce-1dbd9f18ccf0”,
“name”: “Filter Video”,
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 1,
“position”: [
940,
620
]
},
{
“parameters”: {
“jsCode”: “$input.item.binary.data.fileName = ‘Main Gate’\nreturn $input.item;”
},
“id”: “ccc6f98b-1362-429a-813f-832553120a3a”,
“name”: “Split out attachments1”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
680,
660
],
“disabled”: true
},
{
“parameters”: {
“operation”: “sendVideo”,
“file”: “-1002090795915”,
“additionalFields”: {}
},
“id”: “xxxxxx”,
“name”: “Telegram1”,
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.1,
“position”: [
1380,
660
],
“credentials”: {
“telegramApi”: {
“id”: “xxxxxxxxx”,
“name”: “Telegram account”
}
},
“disabled”: true
}
],
“pinData”: {},
“connections”: {
“Fetch unread messages with attachement”: {
“main”: [
[
{
“node”: “Mark message as read”,
“type”: “main”,
“index”: 0
},
{
“node”: “Split out attachments”,
“type”: “main”,
“index”: 0
}
]
]
},
“Split out attachments”: {
“main”: [
[
{
“node”: “Split out attachments1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Schedule Trigger”: {
“main”: [
[
{
“node”: “Fetch unread messages with attachement”,
“type”: “main”,
“index”: 0
}
]
]
},
“Filter Video”: {
“main”: [
[
{
“node”: “Telegram”,
“type”: “main”,
“index”: 0
}
]
]
},
“Split out attachments1”: {
“main”: [
[
{
“node”: “Filter Video”,
“type”: “main”,
“index”: 0
}
]
]
},
“Telegram”: {
“main”: [
[
{
“node”: “Telegram1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “4ad18429-2e10-40ea-b125-6a592e4cf7ad”,
“id”: “lHQLNBYN8YEY9FkY”,
“meta”: {
“instanceId”: “4ef13a48da03ff005343190f8f308027808c33090a2fa5dc6b42b26435acb89f”
},
“tags”:
}

`

Information on your n8n setup

  • **n8n version: Cloud
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):n8n cloud

This is an image of the last node on the workflow

Hey @Dean_Rosin,

Welcome to the community :raised_hands:

Can you toggle the Binary Data option and see if that works.

Thanks, I tried this and it now works. :slight_smile:

1 Like

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