The message in telegram can be forwarded from users/chats/channels to other users/chats/channels. The message type has a fwd_from
field with type messageFwdHeader
- the from_id
field inside of this object describes where the message comes from (user or channel). If we're talking about a channel who posted this message, we would have channel_post
field populated with the message ID.
All seems to make sense. Someone posted a message, it got forwarded or re-forwarded any number of times, but we still have the ID of the original author as well as message's ID.
But there are also saved_from_peer
and saved_from_msg_id
fields. Citing from the docs:
saved_from_peer [...] Only for messages forwarded to the current user (inputPeerSelf), full info about the user/channel that originally sent the message
saved_from_msg_id [...] Only for messages forwarded to the current user (inputPeerSelf), ID of the message that was forwarded from the original user/channel
But... we already seem to get both of these pieces of data inside from_id
and channel_post
fields, don't we?
We can compare the definitions of from_id
vs saved_from_peer
: The ID of the user that originally sent the message
vs [...] full info about the user/channel that originally sent the message
.
The types of the fields are the same, the definitions have no significant difference.
What do these fields actually mean?
As the docs state saved_from* fields are utilized on forwarded messages to yourself, the "Saved Messages".
Not much more into it, ignore it if you're not dealing with saved messages, this exists incase you wanted to go back to the context in joined groups too, since channel_post is only for channels if forwarded outside of saved message.
it gives you the message id in the saved_from peer and naturally the saved from peer.
the from_id is utilized as the circular avatar of user who sent the message, which can be equal to saved_from peer sometimes (when message was sent in broadcast, no sender is visible so will be the channel itself)