1- Copy .env.example to .env and add telegram bot token.
cp .env.example .env
2- Put the telegram bot token in the .env file.
3- Start the services.
docker-compose up
4- Create the databases.
docker-compose exec rails_app bundle exec rake db:create
5- Run the migrations.
docker-compose exec rails_app bundle exec rake db:migrate
6- Run the specs.
docker-compose exec rails_app bundle exec rspec
This app is run using docker in 2 modes rails server and telegram:bot:poller using this gem (similar to sidekiq).
The TelegramWebhooksController acts as a listener for bot.getUpdates using polling, and message method is called each time a user sends a message to the bot.
Action cable is used to make messages appear in realtime.