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

1

10

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)
Goldner answered 14/3, 2017 at 11:57 Comment(0)
L
17

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.

Lorrianelorrie answered 14/3, 2017 at 12:47 Comment(2)
by the third line of your answer, do you mean two private chats can have the same value in some circumstances?Featherhead
@ShahryarSaljoughi No, each chat is unique to itself there are no intersectionTeleran

© 2022 - 2025 — McMap. All rights reserved.