title: Telegram echo bot for channels
body: <p>I have the following telegram bot written in <code>Python (3.x)</code>:</p>
  
  <pre><code>import telebot
  import subprocess
  from telebot import types
  import os
  
  bot = telebot.TeleBot(os.environ['BOT_API_TOKEN'])
  @bot.message_handler(commands=['start'])
  
  def save(messages):
      for m in messages:
          if "keyword" in m.text:
              f = open("channel", "a")
              f.write(m.text +  "\n")
              f.close()
              bot.send_message(m.chat.id, "Saved!")
  
  bot.set_update_listener(save)
  bot.polling()
  </code></pre>
  
  <p>The idea is to store in the file <code>channel</code> the messages that contain the word <code>keyword</code>. This bot works perfectly if I talk to him, but if I add the bot to a channel, it doesn't work. The bot has disable the privacy mode and enable the joingroups option.</p>
  
  <p>I have another bot that do the same but with different code:
      import logging
      import os
      from telegram.ext import Updater, MessageHandler, Filters</p>
  
  <pre><code>updater = Updater(token=os.environ['BOT_API_TOKEN'])
  dispatcher = updater.dispatcher
  def save(bot, update):
      print(update.message.text)
      if "keyword" in update.message.text:
          f = open("channel", "a")
          f.write(update.message.text +  "\n")
          f.close()
          bot.sendMessage(chat_id=update.message.chat_id, text="Saved!")
  
  save_handler = MessageHandler(Filters.text, save)
  dispatcher.add_handler(save_handler)
  updater.start_polling()
  </code></pre>
  
  <p>I don't mind in which version can you help me.</p>