2023 goals revised

On July 4th, 2023 in Myself

Half year is gone and many things happened. Life is still changing a lot every month and I couldn’t create new routines for the long term.

What I could do better on the second semester?

First of all, I need to keep track of my goals every month. I didn’t do that last 6 months and lost control of my activities.

Second, I must focus on work. It’s taking a lot of my sanity, so I must set very precises goals to avoid losing focus and energy.

Last, I’ll change some of my goals.

1. Keep writing down my projects

I didn’t do that, but I’ll try again. This is one of the must do activities to maintain the track of my bigger goals.

2. Keep reading, listening and writing in English

This one is easy and I’ve been improving my writing skills everyday.

3. Have all my photos (from Japan) edited

I’m removing this goal so I can focus on work.

4. Have Home Assistant fully functional at my new home

It’s half done and I do believe that I’ll complete in time.

5. (Try again to) learn how to write in Arduino

I’m removing this goal so I can focus on work.

6. Study programming, data science and machine learning

Last year I progressed studying programming languages. I already progressed a lot during the last months.

Start and ending period: starting now until the end of the year
How often: 2 hour a week at least.
How: programming using Python and Javascript

7. Physical exercises

Yoga or other activity. 3 times a week. That’s all.

Start and ending period: starting now until the end of the year
How often: 3 times a week for at least 45 minutes each
How: Ashtanga Yoga, Lian Gong Shi Ba Fa, and Gym

8. Meditate

Meditating is still a necessary activity this year.

Start and ending period: starting now until the end of the year
How often: 3 times a week
How: try different sort of meditation styles until finding one that fits me better

9. Keep reading books

12 books for 2022 was a very doable goal. I’ll keep this number.

Start and ending period: starting now until the end of the year
How often: daily
How: read 12 books this year or 1 book every month

10. Avoid getting involved with Work Work, a lot

This goal is completely changed. Despite not getting involved with work, this year is the year to advance a lot at work.

11. Be prepared for the work of the future

I’ll just keep tracking this goal.

Tags: 2023 goals

Building a Telegram Bot with Google Script: Unlocking Automation Potential

On June 22nd, 2023 in Tech
Trying to make a cute robot illustration using Stable Diffusion

Telegram bots have become a popular way to automate tasks and enhance user experiences. They allow us to interact with various online services, retrieve information, and perform actions through a user-friendly interface.

I’ve been using Telegram Bot platform for the last 3 years, but only as a tool to send message and not to interact with the automation. This year, due to work demands, I’ve started searching for a way of creating interactive Telegram bots without the need of running a server or paying a service to provide 24/7 availability to run my bots.

In this blog post, I’ll try to show how to leverage the power of Google Script to create and run a Telegram bot.

DISCLAIMER: I’ll not show code here, but references that I gathered that may be useful for those looking for creating bots.

The limitations

To begin with, we must let noted some limitations of using the Google Platform:

1. Google limit the use of consumer accounts to 6 minutes of execution and 30 simultaneous execution.
2. Google script works using Javascript and you won’t have ready to go libraries to make your work easy. There are some people that have been trying to provide some tools, but none of them are robust like python-telegram-bot.
3. You’ll have to use what’s available at the Google Platform as tools. Probably you’ll be using a Google Spreadsheet as your database, for example.

Now to the real stuff.

An introduction to Telegram Bots

Before diving into the technical aspects, let’s have a brief overview of Telegram bots. Bots are special Telegram accounts that are operated by software rather than humans. They can interact with users through messages, process commands, and perform actions based on user input. Telegram provides a comprehensive API that allows developers to create bots with ease and integrate them into various workflows.

To create a Telegram bot, you need to start by creating an account on Telegram and obtaining an API token. This token serves as a unique identifier for your bot and enables communication with Telegram’s API. Once you have the token, you can proceed to create a new Google Script project in Google Drive.

I won’t write the details of how to do it. It’s well documented all over the web, including Telegram website, with clear steps and images.

An introduction to Google Script

Google Script is a cloud-based scripting platform offered by Google. It enables users to write and run JavaScript code within various Google products, such as Google Sheets, Gmail, and Google Drive. The power of Google Script lies in its ability to automate tasks and interact with external APIs, making it an excellent choice for integrating Telegram bots.

How to combine both?

The interactions of the Telegram Bot and Google Script happens using Telegram Bot Webhook and Google Script WebAPI.

We must setup the Telegram bot sending the webhook address, after that, all messages sent to the bot will be processed by the Google Script. This video shows in details how to do it.

Handling User Commands

Telegram allows us to create “User Commands” to trigger specific actions. For example, a user might type “/weather London” to request the weather in London. In Google Script, you can define functions that parse incoming messages, extract commands, and execute corresponding actions. By using regular expressions or string manipulation techniques, you can extract the desired information from user messages and respond accordingly.

Data storage

Regarding storing and Retrieving Data, Google Script provides various options for data storage, such as using Google Sheets, Properties Service, or external databases. Depending on the complexity of your bot, you can choose the most suitable method for storing and retrieving data. I personally use Google Spreadsheets due to the ready to use classes that Google Script provides.

Handling coversations

For handling conversations, the best code available is the python-telegram-bot. In JavaScript, I highly recommend using Francesco Miccolis’s “Google App Script Conversational Telegram Bot” (GAS-conversational-telegram-bot).

He worked “translating” python-telegram-bot to a useful repository. It’s ready to use and it works perfectly.

My projects so far

I’ve been creating some projects using what I learned:

  1. A bot conversation bot that I inform how much and with what I spent my money. It’s much easier than opening my Google Spreadsheet to add a new line. Also, my partner feels more motivated to also contribute.
  2. A bot that saves a photo sent to it to a Google Drive folder.
  3. A bot that saves a photo sent to it to a Google Drive folder, edit the photo using various Google Apps and return it edited.


Integrating a Telegram bot with Google Script provides a powerful and flexible solution for automating tasks and interacting with users. By combining the capabilities of Google Script and Telegram’s API, you can build bots that retrieve data, perform actions, and streamline workflows seamlessly.

Ps: this post was built with the assistance of ChatGPT with a lot if modifications to fit my needs.

Tags: 2023 automations