/telegram-expense-bot

A bot that helps you manage and track your daily expenses.

Primary LanguageJavaScript

telegram-expense-bot

This is a bot for the Telegram messaging app using their bot platform. The code is open-source and consequently anybody could set up an own instance of the bot. To learn how to do so, see this section. The official hosted version is available as @ExpenseBot. To learn more about this bot, please refer to this blog article or just send the bot a message with the /help command.

What does it do?

This bot’s purpose is to help people manage their daily expenses and keep track of their financial situation. Users can add expenses from wherever they are using a few simple commands from within the chat and have an eye on how much they have spent in a month or a day. This obviates the need for confusing Excel spreadsheets or paper notes.

How to host it myself?

Prerequisites

In order to host this bot on your own, you need a few things.

  • Server to run the bot on (since the bot uses the long polling method to get updates instead of the web-hook one, you don't need HTTPS certificates or ports to be exposed)
  • Node.js (preferbly at the latest version)
  • A MongoDB database (you can use mlab.com to get a free, hosted MongoDB)
  • A bot token, which you get from registering a new bot to the @BotFather

Configuration

To configure your bot, clone this repository and then edit config.json file.

  • DB_URL: your MongoDB's complete URL including hostname, port, username, password and database name (if using mlab, you can simply copy this from their website)
  • DB_COLLECTION: the name of the database collection where your data should be stored, e.g. "expenses_live"
  • BOT_TOKEN: the token you got from the BotFather
  • BOT_NAME: the bot's name, e.g. "ExpenseBot" in my case
  • BOT_TELEGRAM_USERNAME: the bot's actual unique Telegram username, e.g. "@ExpenseBot" in my case (note that this can differ from the BOT_NAME, which is not unique)

Run

$ npm start

License

MIT @ Ferdinand Mütsch