Error in Telegram Node

Describe the problem/error/question

A telegram node, that was working perfectly that far was suddenly giving the following error message.

What is the error message (if any)?

400 - {“ok”:false,“error_code”:400,“description”:“Bad Request: failed to send message #1 with the error message "Wrong file identifier/HTTP URL specified"”} - Bad Request: failed to send message #1 with the error message “Wrong file identifier/HTTP URL specified”

Information on your n8n setup

  • n8n version: 1.16.0
  • Database (default: SQLite): Percona
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system:

Hi @Martin_Neumann :wave: I’m not so sure with relation to Telegram and what it expects, but was this URL in a different format than you’ve previously used? Telegram isn’t happy with the URL you provided, going by that error :sweat_smile:

Cheeky edit - it looks like it’s an issue with that specific URL.

This works, but this fails.

What might be the issue here is the url you’re using has no content-type header.

I did not change any in the parameters, and it has worked before. For the Chat ID I have used sometimes the ID number, other times the handle like I did here and normally both formats are working.

Hey @Martin_Neumann,

It won’t be with the chat id the issue is likely to be coming from the server you are getting the image from. When you pass the image url to Telegram once it has it Telegram will try and work out what image it is and download it, In this case I suspect because the server you are getting the image from doesn’t have a content-type header to let Telegram know it is rejecting it.

Sadly though this is not an error we have any control of so you may need to reach out to Telegram support with the image url for further clarification.

Do you think that this specific image has a different content type header than others on the server? Because it was working in the past, and seems to be still working with other images in other workflows.


Here a screenshot without an image which is failing as well.

Hey @Martin_Neumann,

It may not be the header that was just something I noticed between an image that works and an image that doesn’t. The only thing we currently know is that Telegram is not happy with the URL and this is not an issue with n8n.

I took a quick look at the site and found that this image works https://www.abundanthealth.info/wp-content/uploads/2024/02/St-Johns-Wort.jpg and this one https://www.abundanthealth.info/wp-content/uploads/2024/02/Pulses.jpg is the original that fails, I did wonder if it maybe the dimensions of the image but that seems to be ok when using an image generator for testing.

Your second issue is unrelated or should be, The first issue is Telegram returning…

Wrong file identifier/HTTP URL specified

This second issue is Telegram saying it can’t parse the entities, Can you share the full input JSON so we can test that? It could be that it as the default message type is HTML it thinks there is HTML in the content and it can’t work out what to do.

So in relation to the image, when I look at it in the browser it looks fine. So you say you tried to send it to telegram and it fails? So is there something specific about this image that Telegram does not like?

About the second node, here is the input data:

[
{
"bounceType": "Transient",
"bounceSubType": "MailboxFull",
"Time": "2024-02-04T14:51:39.000Z",
"emailAddress": "[email protected]",
"status": "5.2.2",
"diagnosticCode": "smtp;554 5.2.2 mailbox full; STOREDRV.Deliver.Exception:QuotaExceededException.MapiExceptionShutoffQuotaExceeded; Failed to process message due to a permanent exception with message [BeginDiagnosticData]The process failed to get the correct properties. 0.35250:A0110000, 1.36674:02000000, 1.61250:00000000, 1.45378:02000000, 1.44866:14000000, 1.36674:06000000, 1.61250:00000000, 1.45378:0F000000, 1.44866:0B000000, 1.36674:A1000000, 1.61250:00000000, 1.45378:1E000000, 1.44866:65000000, 1.36674:09000000, 1.61250:00000000, 1.45378:86000000, 1.44866:00010000, 1.36674:08000000, 1.61250:00000000, 1.45378:89000000, 1.44866:00100000, 16.55847:12010000, 17.43559:0000000012040000000000000000000000000000, 20.52176:140F519C2000000003000136, 20.50032:140F519C901770204000B830, 0.53414:0201DA36, 0.35180:DF110000, 255.23226:0A001A32, 255.27962:02000000, 255.27962:06000000, 255.17082:DD040000, 0.24929:0A002F3D, 4.21921:DD040000, 255.27962:FA000000, 255.1494:0B003A66, 0.38698:87000000, 1 .41134:87000000, 7.36354:010000000000010C87000000, 1.41134:87000000, 7.36354:010000000000010C87000000, 0.34102:01000000, 5.29818:0000000030303036343030302D626666372D393332382D303030302D30303030303030303030303000000000, 5.55446:00000000333A300003000000, 7.29828:E612512C0400000010000000, 7.29832:000000C00300000007000000, 4.45884:DD040000, 4.29880:DD040000, 4.59420:DD040000, 7.49544:010000000000010C0F010480, 8.45434:00400600F7BF289300000000000000000F010480, 1.46798:04000000, 5.10786:0000000031352E32302E373234392E3033323A445530503139324D42313730303A30303732633964332D363361332D343662352D616233302D3131323931383239613661313A3239303634383A2E4E455420362E302E323600000000, 7.51330:0C13DFC99025DC0818000000, 0.39570:12000000, 1.64146:02000000, 1.33010:02000000, 2.54258:00000000, 0.58802:00000000, 1.33010:02000000, 2.54258:00000000, 0.58802:00000000, 1.64146:06000000, 1.33010:06000000, 2.54258:DD040000, 1.33010:06000000, 2.54258:DD040000, 255.1750:03000336, 255.27962:A1000000, 255.17082:B9040000, 0.27745:0A002D67, 4.21921:B9040000, 255.27962:09000000, 0.26881:0A003267, 255.21817:B9040000, 0.60978:1F004E32, 0.36402:0A001870, 4.38450:DD040000, 0.47602:1F005332, 4.63986:DD040000, 0.22945:94120000, 4.31137:DD040000, 0.26529:0B00F410, 4.29953:DD040000, 0.32768:0A000630, 4.33024:DD040000[EndDiagnosticData] [Stage: CreateMessage]"
}
]

And here is how I compose the message in the telegram node:

Abundant Health Bounce
Email: {{$json["emailAddress"]}}
Type: {{$json["bounceType"]}}/{{$json["bounceSubType"]}}
{{($json["bounceSubType"] == 'MailboxFull')?'':'Code:' + $json["diagnosticCode"]}}

Hey @Martin_Neumann,

So you say you tried to send it to telegram and it fails?

Yes like in your test using the 5 pulses image fails but the other image from the same site works fine.

So is there something specific about this image that Telegram does not like?

I don’t know, All I know is Telegram is saying it doesn’t like it. I don’t know why it doesn’t like it as we don’t have any control over that. You would need to either look at both images or raise a support request with Telegram. To me both images seem pretty much the same but they must have their reason for rejecting it.

I have just given your text a quick test and for me it is oddly sending ok, Can you share the json for the node? I wonder if maybe you are using the v1 node and not a v1.1 node, Could you also try adding an Addional Field and set the Parse mode to HTML and see if that helps.

Alright, here is the JSON of the telegram node:

I do not know what is the difference of a v1.1 node and how I would do that. Also not clear on the HTML parse mode. Can you give me further instructions?

Hey @Martin_Neumann,

That is an older Telegram node but shouldn’t be an issue, under Additional Fields / Options add the parser option and set it to HTML this will stop telegram from trying to treat the content as markdown and will work.

Alright, retrying the failed workflows after that change was at least working. Hope it is resolved.

1 Like

I actually checked back a few days later and there are still a large number of executions that are failing with the same error, even though I switched over to HTML mode. Interestingly, about 2/3 are going through and about 1/3 is failing. It is quite strange.

It would be worth checking the content being sent to see if there is anything unexpected in it.

Here a sample message being sent to Telegram:

Abundant Health Bounce
Email: [email protected]
Type: Transient/General
Code:smtp; 550 5.1.0 <0107018e056656c1-0bc1d1c2-5652-4862-8e03-f26cfb394285-000000@mail.stressmanagement.tools> sender rejected. Please see https://www.spectrum.net/support/internet/understanding-email-error-codes for more information AUP#In-1010

Could it be that the <> is tripping it off since I switched to HTML mode?

Hey @Martin_Neumann,

That could be it, Telegram will try and parse the message using whatever format you tell it you are using although I would have thought it would be smarter than that. It could be worth testing without those to see what happens.

I did escape those 2 characters adding the code:
.replace(/</g, “<”).replace(/>/g, “>”)
After that I ran a successful retry of the workflow. So it looks like Telegram is struggling with those characters.

I guess Telegram is expecting it to be HTML, I will see if we can work around it with encoding without changing the message itself but it might be worth reporting it to the Telegram team as a bug as well.

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