B. Azizan B. Azizan - 2 years ago 577
Node.js Question

Node Telegram Bot API return error 400

I was wrote a Telegram bot with Nodejs. To send an image to the user I am using the following commands :

chat_id: msg.chat.id,
caption: 'Test caption',
files: {
photo: '../change-db-shop-url.png'
}, function (err, 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?

Answer Source

Resolved :

var photo = __dirname+'/../Android.png';
bot.sendPhoto(msg.chat.id, photo, {caption: "I'm a bot!"});
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download