Skip to main content

messages.getSavedHistory

Fetch saved messages » forwarded from a specific peer, or fetch messages from a monoforum topic ».

func (c *Client) MessagesGetSavedHistory(ctx context.Context, request *MessagesGetSavedHistoryRequest) (MessagesMessagesClass, error)

Calling this method​

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesGetSavedHistory(ctx, &tg.MessagesGetSavedHistoryRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // MessagesMessagesClass
return nil
})

Parameters​

NameTypeRequiredDescription
ParentPeerInputPeerClass—If set, fetches messages from the specified monoforum, otherwise fetches from saved messages.
PeerInputPeerClassyesTarget peer (or topic)
OffsetIDintyesOnly return messages starting from the specified message ID
OffsetDateintyesOnly return messages sent before the specified date
AddOffsetintyesNumber of list elements to be skipped, negative values are also accepted.
LimitintyesNumber of results to return
MaxIDintyesIf a positive value was transferred, the method will return only messages with IDs less than max_id
MinIDintyesIf a positive value was transferred, the method will return only messages with IDs more than min_id
Hashint64yesResult hash

Returns​

MessagesMessagesClass

Possible errors​

CodeTypeDescription
400PEER_ID_INVALIDThe provided peer id is invalid.

References​