Skip to content

Firefly III Telegram bot for faster interaction with the service.

License

Notifications You must be signed in to change notification settings

cyxou/firefly-iii-telegram-bot

Repository files navigation

Firefly III Telegram Bot

This Telegram bot facilitates creating Firefly III transactions as well as provides some capabilities to manage other Firefly's entities like Accounts, Categories, Reports, etc.

screenshot

️⚠ Notice: Limited Firefly III Version Support

This Telegram bot is developed for use with Firefly III finance manager. However, due to time constraints, the support for different Firefly III versions may be limited.

Please be aware that I may not be able to promptly address issues or developments related to all Firefly III versions. Users are encouraged to consider this while using the bot with different versions of Firefly III.

For the best experience, it's recommended to use this bot with supported Firefly III versions. Your understanding and cooperation are appreciated.

Version Compatibility

  • Version v2 of this bot has been tested with Firefly III v6.0.30.
  • All other versions of Firefly III might not work properly with this bot.

Setup

First you'll have to generate a Telegram Bot token through BotFather. Once you generate the token, keep it safe.

Docker (Recommended)

docker run \
  --rm --it --init --name firefly-bot \
  --volume `pwd`/sessions:/home/node/app/sessions \
  --env BOT_TOKEN=<your-bot-token> \
  cyxou/firefly-iii-telegram-bot:latest

You may also provide BOT_TOKEN via the .env file. For this just rename the example.env file to .env and update it with your values. Then you can pass it to docker like so:

docker run \
  --rm --it --init --name firefly-bot \
  --volume `pwd`/sessions:/home/node/app/sessions \
  --env-file .env \
  cyxou/firefly-iii-telegram-bot:latest

Once the bot is running, navigate to its Settings and provide all the necessary information to connect it to your Firefly III instance.

Manual

For this you need to have NodeJS installed.

  • Clone the repository
  • Install dependencies by running npm install
  • Run export BOT_TOKEN=<your-bot-token>
  • Run npm start

If you'll have certificate errors when trying to connect to Firefly III instance, stop the bot, do export NODE_TLS_REJECT_UNAUTHORIZED=0 in your shell and start the bot.

Development

To build docker images you would need to install additional tools and packages.

  • Docker
  • Earthly
  • QEMU for building multi platform docker images.

On linux, QEMU needs to be installed manually. On Ubuntu, this can be achieved by running:

sudo apt-get install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker stop earthly-buildkitd || true

More info here.

TODO

  • Add English translations and make it a default language
  • Add transactions improvements (create transfers and deposits)
  • Edit transactions (no date change thus far)
  • Localization based on Firefly user's preferences
  • Accounts management
  • List transactions
  • Add math equations when creating transactions
  • Allow selecting of Liabilities accounts in transactions
  • Configure CI/CD so that it builds and pushes docker images on merges to master
  • Reports
  • Proper error handling
  • Firefly API tests
  • Add JSON database for persistance (used @grammyjs/storage-file)
  • Add date picker when editing transaction (adopt https://github.com/gianlucaparadise/telegraf-calendar-telegram)
  • Migrate from home grown Mapper to Grammy's Menu plugin (partially done)
  • Add tags support

Open API Code Generation

Preface

This thing is used to generate typescript-axios client code for the Firefly III API published here

There is an issue with Configuration model: the generated code has its own Configuration thing that corresponds to axios configuration. Firefly also has Configuration endpoint and corresponding models which upon code generation produce compiler errors due to ambiguity and to naming collision. In order to solve this issue, I've just ignored the Firefly Configuration API generation by adding the api/configuration-api.ts file to .openapi-generator-ignore file and customizing the ./src/lib/firefly/api.ts file, which also had to be referenced in the .openapi-generator-ignore.

How to generate a client code

There is a corresponding task for it in the package.json file: codegen. Hence the command is npm run codegen. Running this command should not introduce any git changes unless you want to rollback or update the API specification URL which is hard-coded in codegen npm task.

Known bugs and limitations

  • No support for multiple transaction splits. It is assumed that transactions consist of only one transaction split.
  • Looks like for a brand new user account the built-in "(cash)" account is created upon first creation of a transaction via the Firefly UI. Until that built-in "(cash)" account is created, the default Expense account will be an account without a name which is weird.
  • Do not try to edit multiple transactions at once, because of the shared state of the transaction under edit. Doing so will result in unexpected behavior.

Feedback

Please join our Telegram group - any feedback is very appreciated!

Telegram Group

About

Firefly III Telegram bot for faster interaction with the service.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages