This is a simple Telegram bot that allows you to create a shared wallet with your friend. In other words, if you lend/borrow some money to/from someone, you'd want to keep an eye on how much each person owes the other. This bot does this accounting for you.
This Telegram bot is serverless, meaning that it doesn't require a server to run it. Amazon AWS lambda functions power the execution, hence it is extremely cost-effective (maybe even a few cents per months).
Since there is no dedicated server involved, the bot functions with webhook. The address of the hook is an HTTP endpoint of the AWS lambda function.
The infrastructure of this bot is handled by Terraform and GitHub actions. To create your own bot, follow these steps:
- Make sure you have an AWS account.
- Create a new Telegram bot using the BotFather.
- Clone this repository, and navigate to the
terraform/remote-state
directory. - Export your AWS credentials as environment variables:
export AWS_ACCESS_KEY_ID=your_aws_access_key_id
export AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
- Perform
terraform init && terraform apply
to create the remote state bucket. - Add an environment to your GitHub repository with the following secrets:
BOT_TOKEN
: The token you received from the BotFather.USER1
: Username and Chat ID of of user1 sperated by a comma. For example:Julia,12345
.USER2
: Username and Chat ID of of user2 sperated by a comma. For example:Jack,54321
.WALLET1
: Currency and symbol of wallet1 separated by a comma. For example:Dollar,$
.WALLET2
: [Optional] Currency and symbol of wallet2 separated by a comma. For example:Euro,€
.WALLET3
: [Optional] Currency and symbol of wallet3 separated by a comma. For example:Toman,T
.
- Add the name of the environment that you added in
.github/workflows/tf-apply.yml
and.github/workflows/tf-destroy.yml
files. - Run the GitHub workflow to create the infrastructure on AWS.
- Go to your Telegram bot and start chatting with it!
- You may create as many wallets as you have defined in the environment!
- Only the two users which were defined in the environment (based on their chat IDs) can add transactions to the wallet. When a user updates a wallet, the other user gets notified by the bot.