I'm making telegram bot on nodeJs and I failed trying to find information on how to send local photo with bot. Official documentation says "upload a new photo using multipart/form-data". What does that mean ? If you now a better way of sending photos (maybe putting folder on server and make requests to it) you can answer too !
Asked
Active
Viewed 1,957 times
1 Answers
0
You can use the method sendPhoto
and pass the photo's url in the photo
parameter. Otherwise you can send the photo to the bot, get the photo's file_id
and put it in the photo
parameter.
Simple request:
{
"chat_id": 777000,
"photo": "https://www.google.com/logo.png",
}
or
{
"chat_id": 777000,
"photo": "AAMCBAADGQEAAQNWw17pM7Z_kM_nftmLt5F49qkR",
}

GioIacca9
- 406
- 4
- 8
-
Can I just put local link like "/sources/img/20-2.jpg" ? – Aug 10 '20 at 20:21
-
No, you can't. The image must be accessibile from the internet so Telegram's servers can download it – GioIacca9 Aug 11 '20 at 18:32