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":"192.168.1.100/html/cam.php"}],"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?
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
NOTES
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)