Using Google Scripts and Telegram BOT to make my personal budget App
I had researched on a lot for Google Scripts and Telegram BOT to work together for making a personal budget App, but whatever was available wasn’t working at all. So, I thought let’s make something by myself.
I spent some 3–4 hours in finishing this BOT.
I agree that there are lot of budget apps which read your SMS messages for transactions, but would you want that data to be available with them? All your financial data, transactions available with this SaaS Apps?
This is something which I don’t want at all. Also, apart from it, you would anyways have to manually enter details about cash transactions. C’mon our economy is not yet fully digitised. There are still lot of cash transactions which you might end up doing daily, maybe weekly.
I don’t want to rant about anymore, so let’s begin.
Process WorkFlow:
For those of you who are new to telegram BOT, I would request you to kindly google at making your own telegram BOT. The only thing which would be required during this whole thing would be the API token of the BOT.
- Create a telegram BOT and get the API token from it and note it somewhere.
- Create a new spreadsheet in google sheets. You may name the spreadsheet as you wish. Make sure to have two tabs, “Budget”, and “Total”. If you name the sheets differently, do make sure to change it in the google script code also.
- The “Total” sheet calculates the entries done in “Budget” sheet.
- Put the header names — Date, UserName, Type, Category, Amount on the “Budget” tab.
- In the “Total” tab, enter 3 row entries as shown below in the picture.
- In cell B1, enter the formula: sumif(Budget!$C:$C,A1,Budget!$E:$E) for calculating all income data from “Budget” tab.
- In cell B2, enter the formula: sumif(Budget!$C:$C,A2,Budget!$E:$E) for calculating all expenses data from “Budget” tab.
- In cell B3, enter the formula: B1-B2 for calculating Balance amount.
- Click on Tools->Script editor to open Google Scripts Window as shown below:
Copy the code of code.gs file from https://github.com/deepankarboro/dailybudgetbot
Replace “token” variable with the Telegram BOT API Token.
You will have to publish the Google Scripts Code as Web App application for you to get “webAppUrl” data.
Click on Publish->Deploy as Web App as shown below:
After the web app being deployed, copy the web app url and assign it to the variable “webAppUrl”. You will be asked permissions while publishing the Google Script File, accept all permissions and move ahead.
To prevent other people to use your Telegram BOT, only authorised users will be able to use the BOT. Replace “Telegram User Name1” variable with your telegram username.
After the web app is deployed, make sure to run the “setWebhook()” function by clicking on the “play” button as shown below:
That’s it, we’re done.
Now you can start your telegram bot and start interacting with it.
If you know google scripts, go ahead and change the code to further customise it according to your way.
Edit: I would like to thank Sanat Mohanty for the suggestion of including the process WorkFlow.
#automation #personalbudgetbot #telegrambot #googlescripts
Ten articles before and after
Manage IT infrastructure using Telegram bot or infrabot.io – Telegram Group
Telegram Bot 2: OCR. Python + AWS Lambda + AWS API Gateway – Telegram Group
data-rh=”true”>使用Python寫一個Telegram Notify – Lofi-nancier – Medium – Telegram Group
Telegram Bot Oluşturma. Telegram son günlerde ülkemizde ve… – Telegram Group
HOW TO DEPLOY RUBY BOT LIVE ON HEROKU – Telegram Group
What is uniREAP ?. What is Staking ? – Telegram Group
On-The-Go Tools for Foreign Flow Analysis – Telegram Group
XiongMai IP Camera Motion Detection Alert Snapshot to Telegram Bot – Telegram Group
Reacting to user feedback in a pet-project. Fast. – Telegram Group