More Telegram bot features using IFTTT

Telegram bot with IFTTT recipesNow that I created a Telegram bot fed by IFTTT, I can add new features using the available channels. A message with the Milan weather condition every morning, for example, or a cool 500px picture during the day to take a break and enjoy the beauty? Possibilities are limited only by IFTTT skills.

The logic is easy: every recipe has a different trigger (the “this” past), and the action is always the same: use the Maker channel to send a POST HTTP call to the Telegram bot, formatting the message with the specific information I want to display. To create the Telegram bot, please look to my previous post.

Weather

Telegram bot weather

The trigger to activate in the Weather channel is “Today’s weather report”, setting the time of the day the report has to be sent. I set 7.00 am because I prepare last minute, but it’s also possible to select “Tomorrow’s weather report” and receive the message the evening for the ones that want to plan what to dress the next day in advance. There are plenty of other information available in the triggers, like sunrise and sunset time, change of conditions / temperature and much more. The city is selected when the channel in connected with the IFTTT account.

The action is the “Make a web request” is the Maker channel, using the following parameters (XXtokenXX and the chat_id have to be changed with the appropriate values):

  • URL: https://api.telegram.org/botXXtokenXX/sendMessage
  • Method: POST
  • Content type: application/json
  • Body: {“chat_id”:”-235327410″, “text”:”Good morning. In Milan {{TodaysCondition}}, max {{HighTempCelsius}} min {{LowTempCelsius}}”}

Cool 500px pictures

Telegram bot with picture

The trigger to activate in the 500px channel is “New Editors’ Choice photo”, selecting one of the available categories, or any.

The action is the “Make a web request” is the Maker channel, using the following parameters:

  • URL: https://api.telegram.org/botXXtokenXX/sendMessage
  • Method: POST
  • Content type: application/json
  • Body: {“chat_id”:”-235327410″, “text”:”Breath and enjoy the beauty: [<<<{{Title}}>>>]({{SourceUrl}})”, “parse_mode”:”markdown”, “disable_web_page_preview”: “false”}

In order to have a preview of the image embedded in the bot message, I used parse_mode set to markdown and i set disable_web_page_preview to false, even if it’s the default setting. Of course the text value is written using Markdown syntax. For more information on the available parameters, the official doc is a good reference. Again, XXtokenXX and the chat_id have to be changed with the appropriate values.

2 thoughts on “More Telegram bot features using IFTTT

  1. Ciao, mi servirebbe una mano: vorrei creare un bot telegram che condividesse in automatico, in un canale, i link dei prodotti che scelgo su amazon. La struttura del messaggio dovrebbe essere -foto, -titolo, -descrizione, -prezzo, -link (con il mio tag. Anche se non credo sia un problema aggiungerlo dopo).
    Vorrei sapere se mi conviene (a livello di velocità e di difficoltà) creare un bot con telegram (magari usando python che vorrei imparare), creare un bot con l’aiuto del maker di ifttt, oppure utilizzare solo quest’ultimo dato che esiste il canale telegram per ifttt?
    Se hai qualche altra alternativa per me va benissimo lo stesso :)
    Ultima cosa, giusto per, sarebbe comodo avere un’estensione del browser tipo pocket che salvasse in automatico il link, però non è fondamentale avendo la sitestripe amazon in alto.
    Grazie in anticipo, aspetto con ansia una tua risposta!
    Umberto

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.