This is an application that scrapes apartment offers from websites of Wohnungsbaugesellschaften and Wohnungsgenossenschaften in Berlin and sends notifications about them.
- Install Ruby - use version from
.ruby-version
file - Install PostgreSQL
bundle install
rails db:setup
rails console
to test that it runs
You need to create your own Telegram bot and group to run the test suite and send notifications in production.
- Create the Telegram bot as described here. This will give you
TELEGRAM_TOKEN
. - Create a new Telegram group and invite to it your bot and
@GroupIDbot
. - Send
/id
message in the group and the bot will give you the chat ID of the group. This isTELEGRAM_CHAT_ID
.
TELEGRAM_TOKEN=your_token TELEGRAM_CHAT_ID=your_chat_id rails spec
Apart from all tests passing, a test message should appear in your Telegram group.
The application is deployed to Heroku. The deployment happens automatically
after each push to the main
branch.
If you'd like to deploy the application on your own - to Heroku or another platform - here are the few things to pay attention to:
- Set the environment variable
TELEGRAM_TOKEN
(Config Vars in Heroku) - The application has no own user interface at the moment. Telegram serves the role of the user interface. The entry point to the application is the Rake task that checks for offers.
- You need to run the Rake task regularly -
rails apartments:get_new
. On Heroku you can use Heroku Scheduler addon for that. On your own server this may be a Cron job. - Create at least one receiver. The receiver defines to which Telegram group the notifications go and which filters need to be applied:
rails console
or:
heroku console
and then:
Receiver.create!(
name: "just a label",
telegram_chat_id: "your_chat_id",
include_wbs: true,
minimum_rooms_number: 1,
maximum_rooms_number: 10
)