getUserPersonalChatMessages method
Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user.
userId Unique identifier for the target user.
limit The maximum number of messages to return; 1-20.
On success, an array of Message objects is returned.
See: https://core.telegram.org/bots/api#getuserpersonalchatmessages
Implementation
Future<List<Message>> getUserPersonalChatMessages(
int userId,
int limit,
) async {
final params = <String, dynamic>{'user_id': userId, 'limit': limit};
final payload = Payload(params);
final response = await _makeRequest<List<dynamic>>(
APIMethod.getUserPersonalChatMessages.name,
payload,
);
return response.map((json) => Message.fromJson(json)).toList();
}