Unable to send text_link from telegram bot

I'm working on a RPi Zero W based doorbell camera, that sends a picture with a caption via a telegram bot. Sending the pictures with a text only caption works flawlessly. However, I would like to include a text link to the livestream inside the caption, but have thus far been unsuccessful in doing so. In order to get it this work, I have tried the text link format as described here.

Unfortunately, this this doesn't result in any hyperlink in messages received from the bot. This is strange, because sending pictures with the text_link in their caption to the bot itself, maintains their formatting and results in a working link.

Using the receiver block from node-red-contrib-telegrambot, I was able to intercept a received message with the desired formatting. Its payload looks like this:

{"content":[image data array],"type":"photo","caption":"There's someone at the door Live Image","entities":[{"offset":27,"length":10,"type":"text_link","url":""}],"chatId":xxxxxxx}

Unfortunately, when I use the same formatting to make the bot send images, the picture and the caption work, but the link behind "Live Image" is gone.

Does anyone have an idea how I can get the link to work?

You should be able to use 'markdown', to show it's a URL, by surrounding it with < and > as shown below.


1 Like

Thanks, but unfortunately this didn't work.

To be clear I'm looking for an equivalent to the following HTML code:

There's someone at the door. Live Image

Try using markdown...

msg.payload = {
  content: msg.payload, //the image buffer
  caption: `There's someone at the door. [Live Image](http://camera_url).`,
  type : 'photo',
  chatId: "xxxx"
msg.payload.options = { parse_mode : "Markdown" };

return msg;
1 Like

That didn't work either. When I use markdown within this string, telegram displays the string character by character, hereby ignoring the markdown.

When I try caption: 'There's someone at the door.' [Live Image](http://camera_url) (so outside of the string), I get a "bad invocation" error.

Why are you doing that?

Put the link URL inside the string

caption: `There's someone at the door. [Live Image](http://camera_url).`, 


Firstly, to confirm, are you using node-red-contrib-telegrambot?

Try this as an example - PS dont put the [Live Image](http://xxxxxx) part outside of the quotes - just do exactly as I have below

msg.payload = {
  content: msg.payload, //<<set the content to your image buffer
  caption: `There's someone at the door. [Live Image](http://google.com).`,
  type : 'photo', // << DONT CHANGE THIS
  chatId: "xxxx" // << set chatId correctly
msg.payload.options = { parse_mode : "Markdown" }; // << DONT CHANGE THIS
return msg; // << DONT CHANGE THIS


  • For some odd reason, the URL is NOT rendered as a hyperlink in telegram web - only in the mobile app (andoid)
  • For some odd reason, the URL is sometimes NOT rendered as a hyperlink when it doesnt end with .com or .something - but only when the type is "photo"
  • Messages that are not "photo" type always render the markdown hyperlink correctly

So - you might want to consider ...
OPTION1: sending two separate messages. First one a photo, second one a hyperlink
OPTION2: Just send a text message with a hyperlink to live view
OPTION3: Send a photo as you do now & use a command like /live to get the link sent to you
OPTION4: Send a message "Theres someone at the Door, [Live Image](http://xxxx)" AND a "keyboard" with the option "Get Image" (to get a static picture)

Thanks! This worked.

My message was missing the:

msg.payload.options = { parse_mode : "Markdown" };

I'm using the node-red-contrib-telegrambot by the way.

Yeah, that was the critical bit to using markdown :rofl:

Sorry - I've been out today and missed all the interactions.

This is what I use in a function node to get Node-RED's dashboard to appear as a link.

msg.payload = {chatId: "12345678", type:"message", content:"<!/>"};
return msg;

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