When a user interacts with your bot in a private chat, the update.message object contains specific details based on the content sent.
- Text Messages: Include
text, message_id, from (user info), chat (chat info), and date. - Stickers: Include the
sticker object. - GIFs: Include both
animation and document objects. - Files: Include the
document object. - Forwarded Messages: Include
forward_from (original sender info) and forward_date.
// User sends a text message in private chat
{
message: {
message_id: number,
from: {
"id": number,
"is_bot": boolean,
"first_name": string,
"username": string,
"language_code": string
},
chat: {
"id": number,
"first_name": string,
"username": string,
"type": "private"
},
date: number,
text: string
}
}
// User forwards a message in private chat
{
message: {
message_id: number,
from: [Object],
chat: [Object],
date: number,
forward_from: {
"id": number,
"is_bot": boolean,
"first_name": string,
"last_name": string,
"username": string
},
forward_date: number,
text: string,
entities: [
{ "offset": number, "length": number, "type": string }
]
}
}