Hello i need to make sending image in telegram bot like on image I have qr code image with link, i want to know how to place image inside quotation.
I tried to make with sendPhoto, but it looks like default image sending with captions
As I can see, it's not actually the sendPhoto
method. It's just the sendMessage
method to send a normal text message. The quoted image is actually the Link Preview.
You can POST to sendMessage
with something like the following data to achieve this:
{
"chat_id": 123456,
"text": "Hello World",
"link_preview_options": {
"url": "https://URL_TO_IMAGE_TO_BE_SHOWN.jpg"
}
}
Or you can do it by GET method by calling the following URL:
https://api.telegram.org/<BOT_TOKEN>/sendMessage?chat_id=<CHAT_ID>&text=Hello+World&link_preview_options={%22url%22:%22<IMAGE_TO_BE_SHOWN.jpg>%22}
Make sure to replace the <BOT_TOKEN>
, <CHAT_ID>
, and <IMAGE_TO_BE_SHOWN.jpg>
with appropriate data.
Hope this helps!