Using Telegram Bot API,
I’m aware that it is possible to send an image via https://core.telegram.org/bots/api#sendphoto
However, how can I embed a remote image into a formatted message?
The message I am looking to send, can be compared to a news article with a title in bold, an image, and a longer text with links. I figured out how to create bold text and links with markdown, but I’m failing at inserting images. How can we do that?
6
Answers
you must set ParseMode in HTML and set your Image Url in A tag like this:
‍
-> never show in messageYou can use zero-width space trick. Works for both Markdown and HTML parse mode.
Markdown:
Result:
Note: The zero-width space is in-between the brackets “[]”.
Method using
<a href=http://.......jpg>..</a>
will show preview of the image below the text.Like this:
a href sample
It will look better if you send an image with a caption.
caption sample
You should just add captions
In our case captions are text. look this image
Using
sendPhoto
rather thansendMessage
is a cleaner way of achieving this, depending on your use case, for example: