node-telegram-bot-api: getChat Error ETELEGRAM: 400 Bad Request: chat_id is empty

When I use getChat method get this error:

Unhandled rejection Error: ETELEGRAM: 400 Bad Request: chat_id is empty
    at request.then.resp (/root/Documents/saveSampad/SaveSampadBot/node_modules/node-telegram-bot-api/src/telegram.js:280:15)
    at tryCatcher (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/root/Documents/saveSampad/SaveSampadBot/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17

Most upvoted comments

Try with this syntax.

bot.getChat(chatId).then(function (msg) {
    // ...
});

@aliir74 Honestly i don’t know, in my bot i use that syntax with getChatMembersCount and it works, so… btw very good 😉