title: Telegram get chat messages /posts - python Telethon
body: <p>I am using Telethon and Python 3.6xx</p>
  
  <p>Been able to retreive message from groups, no problem but when it comes to channels I am stuck. </p>
  
  <pre><code>dialogs = client(get_dialogs)
  for chat in dialogs.chats:
     getmessage = client.get_messages(chat.id, limit=400)
     for message in getmessage:
          print(message.message)
  </code></pre>
  
  <p>I've searched the telethon documentation but most answers were in response to the old <code>get_message_history</code>.</p>
  
  <p>When I'm trying with the following <code>chat.id = 1097988869</code> (news.bitcoin.com) I'm getting an error below (for groups the <code>chat.id</code> works fine):</p>
  
  <blockquote>
    <p>PeerIdInvalidError: An invalid Peer was used. Make sure to pass the right peer type</p>
  </blockquote>