About telegram bots in general.
Following description guides for deployment of Telegram bot on Google App Engine.
Google Cloud SDK Git Any text editor
-
Sign up or login in Google Cloud and create a new project.
-
Go through App Engine wizard.
-
Initialize Google Cloud SDK and go through the login process:
$ gcloud init
- Clone this repo:
$ git clone https://github.com/stop-cran/google-cloud-telegram-bot.git
$ cd google-cloud-telegram-bot
-
Create a new Telegram bot - speak to @BotFather. Copy an API key of the created bot.
-
Update config.ini at your repository folder - set TOKEN to the API key, HOOK_TOKEN to a random URL-friendly string, PROJECT_ID to Google Cloud project name.
-
Deploy the app:
$ gcloud app deploy
- Open app in the browser to set a web hook: https://Google Cloud project ID.appspot.com/set_webhook. This should return:
{
"description": "Webhook was set",
"ok": true,
"result": true
}
- Try to speak to your bot at https://t.me/your Telegram bot ID!
- Read requests logs from default application:
$ gcloud app logs read --service default --limit 10
- Stream requests logs from the command line:
$ gcloud app logs tail -s default
- Application logs (including logs from Python's logging module) are generated per request, and can be viewed in the console:
- Google Cloud Platform -> Stackdriver logging -> Logs
-
You can also read the applications logs via API or by an Android app
-
Manage application versions from the console:
- List all versions:
$ gloud app versions list
- Delete vesions:
$ gcloud app versions delete v1 v2
- Manage versions using GUI :
- Google Cloud Platform -> App Engine -> Versions