Programming: Fill in the micro-blog using the Telegram messenger bot


Ding-Dong – the courier rings. “Thanks!”, snap, snap. Finally! The long-awaited screws are here, at the weekend the started handicraft project can progress after the forced break. Quickly take a photo with your cell phone and “Share with…” the community. Scroll, scroll – dammit, but there’s no button to share to your own blog. Save, log in, upload instead: complicated and slow. Programming an app that does this automatically: a lot of work. There must be an easier way, and others have already programmed the code to share an image.

Messenger Telegram is an app that has built-in image sharing. And Telegram has a powerful bot interface. Instead of programming an app yourself to fill the self-programmed blog with content from your smartphone, you can also simply post the content to Messenger. More precisely: You post in a group with the name of the craft project. The group members are a self-written bot and your own Telegram account. The bot mirrors the content from the group into the Django application.

Telegram bots can work in two ways: either they periodically ask the Telegram servers if there is any news, or they tell Telegram how the server can reach them when there is news. The first method does not combine well with CGI servers such as a Django application, since they are designed to answer requests. A so-called “webhook”, the second method, on the other hand, fits this structure perfectly and it is even more resource-efficient.


  • Access to all content from heise+
  • exclusive tests, guides & backgrounds: independent, critically well-founded
  • Read c’t, iX, MIT Technology Review, Mac & i, Make, c’t photography directly in your browser
  • Register once – read on all devices – can be canceled monthly
  • first month free, then monthly from €9.95
  • Weekly newsletter with personal reading recommendations from the editor-in-chief

Start FREE month

Start your FREE month now

already subscribed to heise+?

Sign up and read

Register now and read the article immediately

More information about heise+

To home page



Source link -64