Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Vzhuh Meme Generator for Telegram

TL;DR. This is a simplistic Telegram bot example. The demo is at It takes the text sent to it, and sends back an image of a magic cat saying this text. To be hosted on Google App Engine.

Output example

What it actually does

  • Sets up two urls to handle requests (both are set in
    • /vzhuh/img - takes the text passed as GET parameter, and returns an image. You can use it directly at, e.g. /vzhuh/img?t=and the bot is ready.
    • /vzhuh/webhook - parses POST requests from Telegram and forms a POST json response with an url to the image and some boilerplate info.
  • Handles either direct messages, or chat messages starting with /vz.
    • Replies with text instructions through sendMessage method if the text after /vz is empty.
    • If the text is provided, the bot replies with an image url through sendPhoto method.
  • The algorithm to fit the text into the rectangular area is in

Google App Engine (GAE)

The bot is hosted on GAE (a part of Google Cloud Platform). There are multiple advantages of GAE:

  • Easy set-up. Or rather: a bit strange, but well-documented set-up.
  • Free quotas. Generous enough for a small, non-viral bot.
  • Free SSL/TLS encryption. For webhook bots, you need a server that can handle TLS1.0+ HTTPS-traffic signed with a trusted and verified certificate.

How to set it up

  1. Register on Google Cloud Platform, create a new App Engine project with <app_engine_project_id>.
  2. Test and deploy the application following these steps. gcloud app deploy app.yaml --project <app_engine_project_id>
  3. Create a bot with the help of the BotFather, note down your <telegram_bot_authorization_token>.
  4. Set up a webhook with the curl request:
curl -v -k -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache"  -d '{
}' "<telegram_bot_authorization_token>/setWebhook"
  1. Send a message to your bot in Telegram, check that it replies. Add the bot to a chat with your friends. Have fun.
Debugging tips:
  • You can always look up GAE logs, they are quite detailed by already, but they also show whatever you just print from your code.
  • To test the server response for different messages, you can use requests sent with curl:
curl -v -k -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache"  -d '{
     "last_name":"Test Lastname",
     "type": "private",
     "first_name":"Test Firstname",
     "last_name":"Test Lastname",
     "first_name":"Test Firstname",
  "text":"/vz and the bot is ready"
}' "http://localhost:8080/vzhuh/webhook"


Vzhuh Meme Generator - a simple Telegram bot on Google App Engine. Demo:





No releases published


No packages published


You can’t perform that action at this time.