I was wrote a Telegram bot with Nodejs. To send an image to the user I am using the following commands :
bot.sendPhoto({
chat_id: msg.chat.id,
caption: 'Test caption',
files: {
photo: '../change-db-shop-url.png'
}
}, function (err, msg) {
console.log(err);
console.log(msg);
});
This error displayed :
Unhandled rejection Error: 400
{“ok”:false,”error_code”:400,”description”:”Bad Request: there is no
photo in the request”}
Can you help me?
4
Answers
Resolved :
It should be:
https://github.com/yagop/node-telegram-bot-api#TelegramBot+sendPhoto
Probably the photo’s url is wrong, Try with another url e.g. : https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png
If you want to send files from urls:
https://github.com/telegraf/telegraf/blob/develop/api.md#file