Skip to content

Telegram Bot to find offers on immobilienscout24.de for given criterias.

License

Notifications You must be signed in to change notification settings

mustafabayar/immo_trakt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

!!! As of 08.06.2022 Immobilienscout turned this API off. So ImmoTrakt does NOT work anymore.

A flat tracker for ImmoScout24. Finds offers according to your search and sends message via Telegram Bot. There is no web scraping, it works via API calls.


Table of Contents

You can configure ImmoTrakt in two ways:

  1. Copy the config_skeleton.yml and save it as config.yml. Then fill all the config parameters inside the config file.
  2. Set the config parameters as environment variables. See the necessary keys below.

Using combination of two is also okay. For example, you can set some values in config file and some others in ENV. But ENV variables will always have priority over config file if they are set.

Config Key ENV key Description Default Value
immo_trakt.frequency IMMOTRAKT_FREQUENCY Duration string as described in https://golang.org/pkg/time/#ParseDuration. For example 1m means every 1 minute. 1m
immo_trakt.include_existing_offers IMMOTRAKT_INCLUDE_EXISTING true if you want the bot to send message for all the existing offers that fits the given search url. false if you want the bot to only start sending offers that are added after the app started running. For most people, use-case of this bot is to see the new offers as soon as possible, not the existing ones as you can already see them when you open the ImmoblienScout website. Therefore false makes more sense to not clutter your chat with tons of already existing offers. false
immobilien_scout.search IMMOTRAKT_SEARCH Simply go to immobilien scout and make a search according to your criterias and then copy the final url to this config value. None. Must be set.
immobilien_scout.exclude_wbs IMMOTRAKT_EXCLUDE_WBS true if you want offers that contains WBS keyword in the offer title to be ignored. false otherwise. false
immobilien_scout.exclude_tausch IMMOTRAKT_EXCLUDE_TAUSCH true if you want offers that contains TAUSCH keyword in the offer title to be ignored. false otherwise. false
immobilien_scout.exclude_senior IMMOTRAKT_EXCLUDE_SENIOR true if you want offers that contains SENIOR keyword in the offer title to be ignored. false otherwise. false
telegram.token IMMOTRAKT_TELEGRAM_TOKEN Register a new bot with the BotFather. Follow the instructions and create your bot. Botfather will return bot token to access the HTTP API. None. Must be set.
telegram.chat_id IMMOTRAKT_TELEGRAM_CHAT_ID This is the personal chat you have with the created Bot. It is okay to not know your chat ID, just leave it empty and we will try to find the correct chat ID using the token. None. Leave it empty if you don't know.

Go to Botfather and request a new bot via /newbot command. Then Botfather will create a bot for you and give you the access token for it.

❗ Before running the application make sure to first send a message to the created bot on Telegram so that the application can detect which chat to send messages. When you run the application and we retrieved the chat ID, it will be logged as:

Telegram chat ID found as XXXXXXXXX

At that point you can take this chat ID and set it to IMMOTRAKT_TELEGRAM_CHAT_ID environment variable. This would make it very convenient because when you restart the application after some time, then you would have to do the same process of sending message to Telegram so that chat ID can be retrieved from API. But if you store the chat ID in config or env variable, you won't need to touch it again.

Make sure to follow How to setup config section to set configuration values properly.

Install Go if you don't already have it. Afterwards execute the following command in project root folder:

go run main.go

Make sure to follow How to setup config section to set configuration values properly.

Afterwards execute the following commands on project root folder:

docker build -t immo-trakt .
docker run -d immo-trakt

Don't forget to check the logs of the running docker container.


Make sure to follow How to setup config section to set configuration values properly.

You can deploy the app to any of the cloud services you prefer. Here I will describe how to use Heroku to run this app free for 7/24:

  1. Install Heroku CLI and Docker
  2. Start the docker engine as it is needed for the following commands.
  3. Login to heroku:
heroku login
  1. Log in to Container Registry:
heroku container:login
  1. Create app on Heroku:
heroku create

This will give output like: Creating cool-app-name... done, stack is heroku-18

  1. Build the image and push to Container Registry(Use the app name created from previous step):
heroku container:push worker --app cool-app-name
  1. Then release the image to your app:
heroku container:release worker --app cool-app-name

This will build the docker image from Dockerfile and release the app on Heroku. Go to your dashboard to view the app. After entering the app dashboard you can see the logs of running app by clicking More -> View logs on top right corner. In the logs, you should see your Telegram chat ID if the app was able to find it.

  1. (Optional) Go to Settings -> Config Vars and add a new config var key as IMMOTRAKT_TELEGRAM_CHAT_ID and value as the found chat ID from the logs.

Also make sure in the Dyno formation widget, worker dyno is ON and there is no web dyno running. Normally Heroku free tier sleeps after 30 minutes of inactivity (Not receiving any web traffic). But this is only valid for web dynos, our app doesn't serve any endpoints therefore we don't need a web dyno, all we need is a background app. Worker dyno is best for this use-case as it doesn't go to sleep. Normally Heroku free tier gives 550 hours of free dyno usage when you register, which means you can not run it 7/24 for whole month. But if you add your credit card information they will increase the free dyno limit to 1000 hours which is more than enough to run an app for entire month.

Always check the logs of the running app, most of the error messages are quite straightforward.

If you see this error:

Telegram chat not found, please first send a message to the bot on Telegram and then try to run the ImmoTrakt again!

Just do what the message says and run it again.

If you see any problem regarding the code such as parsing error etc., please open an issue and I will work on it as soon as I can.

This project is licensed under the MIT License - see the LICENSE file for details

About

Telegram Bot to find offers on immobilienscout24.de for given criterias.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published