First you need to load the chat by username using searchPublicChat(username)
and then call joinChat(searchPublicChat.id)
.
See: https://core.telegram.org/tdlib/getting-started#getting-chat-messages.
All TDLib methods are available and up-to-date at: https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl.