| Landing page | Verified | Failed to verify |
|---|---|---|
![]() |
![]() |
![]() |
- Create your telegram bot (please check section below).
- Signup to hCaptcha to get your site key and secret (please check section below) .
- Install dependencies:
pipenv install --dev(make sure to havepipenvinstalled). - Copy
.env.sampleto.envand add:TELEGRAM_USERNAME,TELEGRAM_TOKEN,HCAPTCHA_SECRETandHCAPTCHA_SITE_KEY.
- Signup to hCaptcha.
- To get
HCAPTCHA_SECRET: go the Settings tab. - To get
HCAPTCHA_SITE_KEY: go to Sites tab and create a new site key.
cd app && FLASK_APP=wsgi.py FLASK_DEBUG=1 python3 -m flask run# start
docker-compose up
# stop
docker-compose downIncase you need to run your the application on heroku:
heroku create <dev_instance_name> --remote development- Add
APP_URLwith your dev instance link
- Create a new bot on telegram and note the
secret tokenand the botusername: Creating a new bot - Telegram documentation - Create a new account on hCaptcha and note the
sitekeyand thesecret token - Invite the bot to your Telegram channel and set it as admin
pipenv run python -m pytest- With coverage:
pipenv run coverage run --include="app/*" -m pytest- Show report:
pipenv run coverage report -mor as html:pipenv run coverage html && open htmlcov/index.html - Run single test method: e.g.
python -m pytest app/tests/test_bot.py -k 'test_is_verified' - Rung single test with
ipdbbreakpoint:python -m pytest -s app/tests/bot_handlers/test_handle_invitation.py
Simply merge all your changes to staging branch, and it will be deployed to the staging heroku on successful builds and tests passing in github.
Merge all your changes to master and it will be deployed to the prod environment.
-
Check the "Setup" section above and make sure that tests passes locally.
-
If using the
herkoucli approach, be sure to run this first:heroku login
-
Make sure you've already remote tracking for your target env (one of):
git remote add <env> https://git.heroku.com/<app>.githeroku git:remote -a staging-hcaptcha-telegram-botheroku git:remote -a prod-hcaptcha-telegram-bot- If using the heroku command, you may want to rename the envs appropriately as they will all be called
heroku git remote rename heroku staging
- If using the heroku command, you may want to rename the envs appropriately as they will all be called
-
Deploy code changes:
git push <env> your_dev_branch:master(push specified branch)git push staging master:master(push master from origin to staging remote master)
-
Run DB migrations:
heroku run "python manage.py db upgrade -d app/migrations/" --remote <env>
-
If DB migration was needed you may need to manually start up the app:
heroku run web --remote <env>(start up app inline)heroku ps:scale web=1 --remote <env>(start up more instances of the app)
- Prod:
- Bot name:
hCaptchaBot - URL: https://prod-hcaptcha-telegram-bot.herokuapp.com/
- Bot name:
- Staging:
- Bot name:
yellow_tg_bot - URL: https://staging-hcaptcha-telegram-bot.herokuapp.com/
- Bot name:
- Check logs on heroku:
heroku logs --tail --remote <env> - The bot must be in a supergroup and the bot must be have admin permissions.




