title: How to deploy and run a telegram bot on heroku?
body: <p>I am trying to deploy and run a telegram bot on heroku.
  I am using python 3 and the library python-telegram-bot.</p>
  
  <p>My .py class called test.py and the git project called telegram_bot.
  I also created a heroku pipeline (includes a project called telegram-bot-1) and connect that to my git. (so every time i puch new commits, heroku start building the project)</p>
  
  <p>these are all my codes in git project (includes test.py, Dockerfile, and herouku.yml):</p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  import sys
  
  from telegram.ext import Updater, CommandHandler
  
  TOKEN = "515148657:dvGVfrSVU78SfvdEtvfZf25EvefvEftnU-8"
  
  def run(updater):
      PORT = int(os.environ.get("PORT", "8443"))
      HEROKU_APP_NAME = "telegram_bot" 
      updater.start_webhook(listen="0.0.0.0",
                            port=PORT,
                            url_path=TOKEN)
     updater.bot.set_webhook("https://{}.herokuapp.com/{}".format(HEROKU_APP_NAME, TOKEN))
  
  
  def start_handler(bot, update):
      user = update.message.from_user
      update.message.reply_text("Hello dear {} :).format(user['first_name']))
  
  
  def get_handler(bot, update):
      stock_name = update.effective_message["text"]
      update.message.reply_text("you said: {}".format(stock_name))
  
  
  if __name__ == '__main__':
      updater = Updater(TOKEN)
      updater.dispatcher.add_handler(CommandHandler("start", start_handler))
      updater.dispatcher.add_handler(CommandHandler("get", get_handler))
  
      run(updater)
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>FROM python:3.7
  
  RUN pip install python-telegram-bot
  
  RUN mkdir /app
  ADD . /app
  WORKDIR /app
  
  CMD python /app/test.py
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>build:
    docker:
      web: Dockerfile
  </code></pre>
  
  <p>all my files are in one folder.</p>
  
  <p>but the logs after auto building on heroku are:</p>
  
  <pre><code>2019-06-01T14:32:57.000000+00:00 app[api]: Build started by user esrvef@gmail.com
  2019-06-01T14:33:55.792474+00:00 app[api]: Deploy 50b099c1 by user esrvef@gmail.com
  2019-06-01T14:33:55.792474+00:00 app[api]: Release v40 created by user esrvef@gmail.com
  2019-06-01T14:33:55.000000+00:00 app[api]: Build succeeded
  </code></pre>
  
  <p>and the code doesn't run. so the bot doesn't work.</p>
  
  <p>what should i do to make it correct?</p>
  
  <p>thanks.</p>