Giter Club home page Giter Club logo

personalexpensereport's Introduction

SUMMARY

๐Ÿ”Ž Purpose

The purpose of this open source software is to provide a solution to personal expense report.

This solution includes a Google Spreadsheet where all expenses are reported, and a Telegram bot integration that allows to view the latest expenses, the total of expense and to add or delete expenses. The delete expenses feature has yet to be implemented for the Mr.RIP compatibility version of this bot.

Features

  • โœ… Useful dashboard to keep track of your expenses total
  • โœ… Easy personalizable expense categories
  • โœ… Data validation in expense sheet
  • โœ… Telegram bot integration with security protocol to avoid unexpected unknown users interaction
  • โœ… Compatible with Expenses-spreadsheets organized in Categories and Subcategories (e.g. Mr.RIP, you can take a look at his spreadsheets here and his blog here!)

Screenshots

Dashboard Expenses
Dashboard Expenses
Personalizable categories Telegram Bot Main Menu
PersonalizableCategories TelegramBot
Telegram Bot Total Expense Telegram Bot Add new expense
TotalExpenses AddNewExpense

๐Ÿ’ช Installation

1. Copy Google Spreadsheet

Create a local copy to your Google Drive of the following spreadsheet:

Remember to save your !!LOCAL COPY!! Google Spreedsheet Id because will be used in the next steps. e.g.: https://docs.google.com/spreadsheets/d/1VyCrEkmIRz4T_TmcKiy__y4NPLEFspRelXOKIIBrvbI/edit#gid=479673556 The spreedsheet id is '1VyCrEkmIRz4T_TmcKiy__y4NPLEFspRelXOKIIBrvbI' <- This is just an example, you will have definetely a different Google Sheet Id, don't use this otherwise the Telegram Bot integration will not work

PAY ATTENTION: If you change any sheet name you'll need to update Telegram bot js code as well.

GoogleSheet

2. Create a Telegram Bot

If you want to integrate the Google Spreadsheet with Telegram, proceed with creating a Telegram Bot.

Remember to save your Telegram Token Id because will be used in the next steps.

AppScript

3. Add App Script to Google Sheet

Copy the content of TelegramBotIntegration.js source code to a new App Script.

Follow this Google Guide to learn how to add a new App Script:

AppScript

4. Deploy App Script as Web Application

Perform a new deployment of the App Script as a Web Application.

In case of problems please follow this Google guide:

Deploy Deploy

5. App Script personalization with tokens

In order to integrate Telegram Bot with Google Sheet we need to personalize the App Script with the tokens saved in the steps above mentioned

Telegram Token

Insert the telegram token saved in step '2. Create a Telegram Bot' into the variable 'token' as follows:

/**
 * @var token
 * @brief 1. Fill with your own Telegram Bot Token Id
 *        (e.g. 521xxxx7165:AAHxxxxxxxxjbHr5l-m8rGxxxxxxwbk)
 */
var token = "521xxxx7165:AAHxxxxxxxxjbHr5l-m8rGxxxxxxwbk";

Web App Url

Insert the web application url saved in step '4. Deploy App Script as Web Application' into the variable 'webAppUrl' as follows:

/**
 * @var webAppUrl
 * @brief 2. Fill with your google web app address
 *        (e.g. https://script.google.com/macros/s/AKfycbwHkLLHeAY-07_A2dmXftSX0JNR8gTpeREQmzo2j2aWmItIuSsFSYzlB1bJNw0Dovd3qw/exec)
 */
var webAppUrl = "https://script.google.com/macros/s/AKfycbwHkLLHeAY-07_A2dmXftSX0JNR8gTpeREQmzo2j2aWmItIuSsFSYzlB1bJNw0Dovd3qw/exec";

Google Spreadsheet Id

Insert the Google Spreedsheet Id saved in step '1. Copy Google Spreadsheet' into the variable 'ssId' as follows:

/**
 * @var ssId
 * @brief 3. Fill with Google Spreadsheet Id
 *        (e.g. 1f_IT_kAFIG0TUOZyXL3nW67fxvd0fuSaw6gbAbtxzEo)
 */
var ssId = "1f_IT_kAFIG0TUOZyXL3nW67fxvd0fuSaw6gbAbtxzEo";

Locale Settings

Insert the locale settings according to your preferences:

/**
 * @var locale
 * @brief 4. Set your locale for date time parsing
 *           e.g. it-IT
 *           e.g. en-US
 */
 var locale = "en-US";

Timezone Settings

Insert the timezone settings according to your preferences:

 /**
  * @var timeZone
  * @brief 5. Set your timezone for proper date formatting
  *           e.g. "Europe/Rome"
  *           e.g. "America/New_York"
  */
 var timeZone = "America/New_York";

Currency Settings

Insert the currency settings according to your preferences:

 /**
  * @var currency
  * @brief 6. Set your currency
  *           e.g. "$"
  *           e.g. "โ‚ฌ"
  */
 var currency = "$";

6. Update App Script Deployment

After those personalization we need to update the App Script deployment.

  • Click on Execute deployment
  • Click on Manage deployment
  • Click on Modify icon
  • Click on Version
  • Click on New Version

UpdateDeploy

7. Execute getMe and setWebhook functions

After having deployed the script, you've to execute 'getMe' and 'setWebhook' functions from Google Apps Script getMe setWebhook

8. Enable Telegram Bot

Send a chat to your personal telegram bot create in step '2. Create a Telegram Bot' with any text

The bot will reply with:

โ›”๏ธ You're not authorized to interact with this bot!

NotAuthorized

Go to the Google Spreadsheet in "Logs" sheet, it will be present a new line as follows:

{
    "update_id": 642486188,
    "message": {
        "message_id": 765,
        "from": {
            "id": 8XXXXXXX6,
            "is_bot": false,
            "first_name": "XXXXXX",
            "last_name": "XXXXX",
            "username": "XXXXXX",
            "language_code": "it"
        },
        "chat": {
            "id": 8XXXXXX6,
            "first_name": "XXXXXX",
            "last_name": "XXXXX",
            "username": "XXXXX",
            "type": "private"
        },
        "date": 1644745924,
        "text": "Hello!"
    }
}

Log

Copy the value of the field message.from.id, in this example has been censored as '8XXXXXXX6' and paste it to the sheet 'Authenticated Users' as follows:

AuthorizedUsers

Now send another message to your Telegram bot and it should reply to you with the main menu, and then you're ready to go with your Telegram integration!

Authenticated

personalexpensereport's People

Contributors

r3d4ng3l avatar lucaosti avatar tobiapoppi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.