working
-
fill .env
-
start project
docker-compose up
or
npm run dev
- setup bot
curl https://api.telegram.org/bot<TELEGRAM_TOKEN>/setWebhook?url=https://europe-central2-zinovik-project.cloudfunctions.net/fuftyfu-bot?token=<TOKEN>
testing
curl --location 'localhost:8080' \
--header 'Content-Type: application/json' \
--data '{
"message": {
"from": {
"first_name": "max",
"language_code": "en"
},
"chat": {
"id": "446618160"
},
"text": "find brest"
}
}'
curl https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://<NGROK ID>.ngrok.io/index
~/ngrok http 8080
gcloud iam service-accounts create github-actions
add roles (Service Account User
and Cloud Functions Admin
) to the service account you want to use to deploy the function
gcloud projects add-iam-policy-binding zinovik-project --member="serviceAccount:[email protected]" --role="roles/cloudfunctions.admin"
gcloud projects add-iam-policy-binding zinovik-project --member="serviceAccount:[email protected]" --role="roles/iam.serviceAccountUser"
gcloud iam service-accounts keys create key-file.json [email protected]
cat key-file.json | base64
gcloud projects add-iam-policy-binding zinovik-project --member="serviceAccount:[email protected]" --role="roles/secretmanager.secretAccessor"
printf "TELEGRAM_TOKEN" | gcloud secrets create fuftyfu-bot-telegram-token --locations=europe-central2 --replication-policy="user-managed" --data-file=-
printf "TOKEN" | gcloud secrets create fuftyfu-bot-app-token --locations=europe-central2 --replication-policy="user-managed" --data-file=-