Telegram - Wrong URL host while sending binary data

I have a base64 jpeg image that I’m moving to binary data, and then sending it to a Telegram chat

What is the error message (if any)?

I’m encountering the error
Bad Request: invalid file HTTP URL specified: Wrong URL host

It should not care about URLs since I specified a binary file, should it?

Stack trace here

{"message":"400 - {\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: invalid file HTTP URL specified: Wrong URL host\"}","name":"Error","stack":"Error: Request failed with status code 400\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:539:35)\n    at IncomingMessage.emit (node:domain:475:12)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}

I made sure that the binary data is actually showing up correctly.

Workflow

Can you please help me?
Thank you!

Hi @Havock94,

I noticed that there are 2 issues for sending binary data in Telegram Node.

  • Necessary HTTP headers are missing while sending multipart/form-data request

  • If file name is undefined/empty/null, Telegram API refuses the request.

I’ve fixed issues and created pull request. After it is approved by n8n team and released in the next version, you will be able to send binary data to Telegram API.

Until that time, as a workaround you can upload your photo to a storage service (imgur, Google Drive, etc.) then use the image URL for sending photo without binary data.

Hope it helps!

2 Likes

Hello, I indeed bypassed the binary part and used a storage service, I just wanted to make sure I was making everything correctly!
Thank you for your help!

Just wanted to confirm that setting the File Name in the Move Binary Data allows to send Binary Data to the Telegram node, so this workaround can be used while waiting for the PR!

2 Likes

Got released with [email protected]

1 Like

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