in ,

paulpierre / informer, Hacker News

paulpierre / informer, Hacker News




and spy on Telegram channelsper accountDetails are logged to a MySQL database, a private Google Sheet and your own private channel for analysis.

This is a functioning proof-of-concept project with known bugs. Feel free to fork, share and drop me a line.

Potential Business Applications********************** Sock puppeteering to overthrow a despotic regime

  • Brand monitoring and sentiment analysis
  • Shilling cryptocurrency at a moments notice for financial gain
  • Influencing sentiment on topical issues
  • Getting in on price action early
  • Running analysis of a telegram channel
  • **************************Features********************** Run all your bots in the cloud while you sleep. Support for Google App Engine Flexible Environment and Docker
  • Write all notifications to private Google Sheet

  • Supports regular expressions for keyword filtering

  • SQLAlchemy for agnostic data persistence

  • image

    Logging contextual message and channel data to a private channel and database

  • Stores meta information about sender of message, channel, number of participants in the channel

  • ****************************image****************************** Auto-joins channels from CSV list containing Telegram channel URLs
  • ********************************

    Persists session of channels joined

  • Login once, bot stays logged in forever without needing 2FA re-authentication

  • Join up to channels per account

  • ********************************OS / Infrastructure

    ********************** Python 3
  • Python packages (Jinja2) 2. ********************************************************************************************************************************************. 3)
  • SQLAlchemy (1.3.) )
  • Werkzeug (0. (**************************************************************************************************************************************. 0)
  • pytz 3)
  • sqlalchemy-migrate (0.************************************************************************************************************************ (0)
  • requests (2.7.0)
  • Flask (1.1.1)
  • Telethon (1.) ********************************************************************************************************************************************. 8)
  • mysql-connector-python (8.0.)
  • Getting Started (**********************************************

    If you’re not interested in kicking the tires and want to light some fires instead, you can run the Informer bot locally and not in a docker instance. A licky boom boom down.

  • Create a virtual environment in the local directory

    virtualenv venv

    pip install -r requirements.txt

  • Runpython3

      . This will create the models inmodels.pyinside your new MySQL database and ensure it is unicode safe for those fun eye-bleeding emojis on TG.

      1. It will also setup some default values ​​for keywords to monitor and channels to join supplied in channels.csv.


      python3 bot.pywhich will take your configuration and spin up an instance of the (TGInformer) class and begin surveillance. You will need to provide the API ID you generated from the instructions below as an argument so the bot knows which account to log into.

          NOTE: If this is your first time logging in, it will send you an authorization code via SMS or via the Telegram app. You will need to enter this to authenticate the bot and log into the Telegram servers. You will only need to do this once as a session file will be generated locally to persist all sessions. This entire process is handled by the Telethon Telegram client SDK.

          Create a telegram account with Burner App

        1. Install the app Burner

          ********************** (Android -)

      • iOS - .com / us / app / telegram-x / id
        1. (**************************************************************

    1. )

    2. Validate with Burner. You will be sent an authcode via SMS, you will need to provide

      1. (******************************************************************

    3. Log into Telegram

    4. Attempt to login with the app by running

      python3 (************************************************)image

        Scaling Telegram accounts

        Figuring out how to scale accounts was a bit of a nightmare as I needed an automated process. Telegram requires you use a real phone number that can recieve texts from a shortcode.

        Unfortunately services with APIs like Twilio are prohibited from receiving SMS from shortcodes in the US, Canada and UK – Can-Twilio-numbers-receive-SMS-from-a-short-code-for fraud purposes. This would’ve been ideal, bahumbug.

        A whole evening was wasted on this endeavor until I remembered a great app I used in the past: Burner (

      – which coincidentally does have an API (). Meaning you can dynamically generate numbers, instantiate a new account and authenticate it all via Telegram’s client SDK in Python (Telethon:

      The best part is Burner numbers are free for 14 days. Telegram accounts connected via client API need only login once and permanently persist sessions. I have not integrated with the Burner API, but the process is straight forward.

      (**************************************************************************Telethon SDK SDK)

      The bot is built on top of the Telethon Python SDK ( https: / /

    5. )

      A few things to note and gotchas encountered in building this proof of concept:

    6. Rate LimitingTelegram does intense rate limiting which will throw FloodWaitErrors. In my research it seems like no one knows the algorithm for this but you want your back off waits to scale in response because when you violate and exceed the unknown rate limit, the waits become exponential. I’ve found a happy medium with my approach to waiting.


        1. Create a Docker repository, instructions here:

      1. Build the Docker image. We’re running on a lean Alpine Python 3.7 image.

        docker build -t (/

      CMD [“python”,””,”${SHILLOMATIC_ACCOUNT_ID}”]You will need to set the environment variableSHILLOMATIC_ACCOUNT_IDto your Telegram accounts API user ID inside your Cloud Provider’s console or export it in your shell environment withexport SHILLOMATIC_ACCOUNT_ID=“ (************************************************

    7. Or you can set or over-ride the entry point in your cloud provider just make sure you provide the Telegram API user ID as an argument:

    8. ******************************************** (python3

      Or you can run the bot inside the shell environment with Docker:

    9. SSH into your remote shell environment

    10. Pull the Docker image from the remote repository:

      docker pull/ / informer: latest

          1. TIP: TelegramX is by far the better client to use for these purposes as it supports multiple login. Download here:

            ********************** (Android -)

      1. iOS - .com / us / app / telegram-x / id **************************************************************************************** / / an-easy-way-to-read-and-write-to-a-google-spreadsheet -in-python.html

        Known Bugs

        Currently a channel must have already been joined in order to begin monitoring of keywords. It is likely you will need to run the ( twice, once to let it join channels and another time to monitor them. I’m aware of this glaring bug and will fix it in the next revision.

      2. ********************************************************************************************Todo********************** Create user interface dashboard for bot management ********************** Create new accounts
      3. Add / remove channels
      4. Add / remove keywords to monitor
      5. View notifications
      6. Recieve web push notifications
      7. Automatically poll the database to update the keywords to monitor in memory
      8. Automate creation of phone numbers via Burner API and authcode process
      9. ********************************************************************************************Getting in touch

        Did you find this project interesting? Please star it if so.

        It was made in two days as a proof of concept for a friend in the cryptocurrency space. If you find any interesting or lucrative applications, I’m always happy to collaborate. You can reach me at:

        @ paulpierre on Twitter or hi (at) paulpierre (dot) com

        Most of my interesting projects are private on github, but feel free to check them out: (

        or past work at http: // www.

        Open Source License. () ********************************************************************************************** () Copyright (c) Paul Pierre Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge , publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  

    11. ) ****************************************************************************************************

      What do you think?

      Leave a Reply

      Your email address will not be published.

      GIPHY App Key not set. Please check settings

      [100% OFF] Linux tutorial for beginners and Level up your career

      [100% OFF] Selling E-books: best way To Make A Living Online in 2020