Skip to content

stop-cran/google-cloud-telegram-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A dummy Telegram bot to be hosted at Google Cloud

About telegram bots in general.

Following description guides for deployment of Telegram bot on Google App Engine.

Prerequisites

Google Cloud SDK Git Any text editor

Steps to add your Telegram bot to Google App Engine

  1. Sign up or login in Google Cloud and create a new project.

  2. Go through App Engine wizard.

  3. Initialize Google Cloud SDK and go through the login process:

$ gcloud init
  1. Clone this repo:
$ git clone https://github.com/stop-cran/google-cloud-telegram-bot.git
$ cd google-cloud-telegram-bot
  1. Create a new Telegram bot - speak to @BotFather. Copy an API key of the created bot.

  2. 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.

  3. Deploy the app:

$ gcloud app deploy
  1. 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
}
  1. Try to speak to your bot at https://t.me/your Telegram bot ID!

Management and debugging

  • 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

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

Versions

References

Google App Engine dashboard

Adding Cloud Source Repositories as Remote

Telegram Bot API

About

Telegram bot on Google App Engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%