skip to Main Content

I want to get messages from a particular channel in Telegram using its API. I know that messages.getMessages is for fetching messages in a chat. But can I use this function to do what I mentioned?
In other words, How can I get messages from a Telegram channel?



  1. you must use layer 40 (or above) of the api in order to use channels. This layer has an specific method to fetch messages from channels

    channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages;

    I haven’t tested old messages.getMessages method, but I guess it won’t work for channels.

    Hope this helps.

    Login or Signup to reply.
  2. To work around the channels you should use channel methods. A list of channel methods are available here :

    channels.getDialogs#a9d3d249 offset:int limit:int = messages.Dialogs;
    channels.getImportantHistory#ddb929cb channel:InputChannel offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
    channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
    channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
    channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory;
    channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool;
    channels.getMessages#93d7b347 channel:InputChannel id:Vector<int> = messages.Messages;
    channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants;
    channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant;
    channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
    channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
    channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates;
    channels.editAbout#13e27f1e channel:InputChannel about:string = Bool;
    channels.editAdmin#eb7611d0 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Updates;
    channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
    channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
    channels.toggleComments#aaa29e88 channel:InputChannel enabled:Bool = Updates;
    channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
    channels.updateUsername#3514b3de channel:InputChannel username:string = Bool;
    channels.joinChannel#24b524c5 channel:InputChannel = Updates;
    channels.leaveChannel#f836aa95 channel:InputChannel = Updates;
    channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
    channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates;
    channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite;
    channels.deleteChannel#c0111fe3 channel:InputChannel = Updates;
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top