Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Difference between `msg.chat.id` and `msg.from.id` in Telegeram Bot?

What is Difference between msg.chat.id and msg.from.id in Telegeram Bot? Apparently, both are the same and Return user id.

bot.sendMessage(msg.chat.id, 'Hi', opts)

and

bot.sendMessage(msg.from.id, 'Hi', opts)
like image 880
Saeed Heidarizarei Avatar asked Mar 14 '17 11:03

Saeed Heidarizarei


1 Answers

a chatId is a unique identifier for a chat, that can be either private, group, supergroup or channel whereas userId is a unique identifier for a user or bot only.

The only time the values can be the same is in a private chat.

Read more about Telegram types here.

like image 185
Mohamed Sohail Avatar answered Dec 02 '22 06:12

Mohamed Sohail