- Make sure you have gcloud command installed.
- Create service account.
- Download it's key in JSON format.
export GOOGLE_APPLICATION_CREDENTIALS="<path to JSON key of service account>"
- Create
prod.env
with content:
PROJECT_ID=<Google project id>
TELEGRAM_API_KEY=<token generated by BotFather>
EXCLUDE_LOG_TIME=True
TELEGRAM_WEBHOOK_TOKEN=<Generate token>
ADMIN_CHAT_ID=<feedback will come to this chat in tg>
Snippet to generate token
import random, string; print(''.join(random.choices(string.ascii_letters+string.digits, k=40)))
- Install
gettext
to haveenvsubst
command - Run
deploy.sh
- Derive your app url.
Example via console:
gcloud app describe --format=json | jq -r '.defaultHostname'
- Register webhook:
curl -X POST -H "Content-Type: application/json" -d '{"url": "<appurl>/tg/{TELEGRAM_WEBHOOK_TOKEN}", "max_connections": 3, "allowed_updates": [“message”]}' 'https://api.telegram.org/bot{TELEGRAM_API_KEY}/setWebhook'