Skip to content

w33ladalah/split-billing-whatsapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Split Billing WhatsApp Bot

A WhatsApp bot built with Go and whatsmeow that helps friends split bills easily.

Features

  • Create and manage bills in WhatsApp groups
  • Add participants and items
  • Send a photo of your bill to extract items and amounts automatically (using OpenAI API)
  • Calculate how much each person owes
  • Send private WhatsApp messages to each participant when a bill is closed, showing their share and payment instructions
  • Multi-language support: English and Indonesian (see /lang command)
  • Translation system for easy localization

Installation

  1. Ensure you have Go 1.16+ installed

  2. Clone the repository

  3. Install dependencies:

    go mod tidy
  4. Build the application:

    go build -o build/split-billing-bot cmd/main.go

Web QR Code UI

  • When you start the bot, it also runs a web server at http://localhost:8080/.
  • Open this page in your browser to view and scan the WhatsApp QR code for login.

Usage

  1. Run the application:

    ./build/split-billing-bot
  2. Open your browser and go to http://localhost:8080/ to view the QR code.

  3. Scan the QR code with WhatsApp to log in.

  4. The bot will now process commands in your chats.

Command List

  • /new [name] - Create a new bill
  • /add [item] [amount] - Add an item to the current bill (optional)
  • Send a photo of your bill to add all items at once (optional, requires OpenAI API key)
  • /join [bill_name] - Join the current bill as a participant (optional)
  • /calculate - Calculate and show how much each person owes in the current bill
  • /close - Close the current bill and send private messages to all participants
  • /help - Show available commands
  • /lang [indonesia|english] - Change bot language preference for this chat

Example

  1. /new Sarapan
  2. Each person types /join to participate
  3. Send a photo of your bill to add all items at once (optional)
  4. /calculate
  5. /close when done (each participant receives a private message with their share)

TODO

  • Add image processing for bill images using LLM
  • Send message to the participants WhatsApp number when bill is closed
  • When user types /join, send message to the user that they have joined the bill
  • Add bill name to the /join command
  • Add bill name to the /calculate command
  • Add bill name to the /close command
  • Add bill name to the /help command
  • Change the database server to use PostgreSQL
  • Use Docker to containerize the application
  • Use GitHub Actions to deploy the application to a VPS
  • Add unit tests
  • Add integration tests

Translations

  • The bot supports English and Indonesian. Use /lang indonesia or /lang english to switch.
  • To add a new language, edit or add files in internal/translations/ following the existing structure.
  • It's not perfect, but it works.

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

If you find a bug or have a feature request, please open an issue on GitHub.

License

MIT

About

A WhatsApp bot built with Go and whatsmeow that helps friends split bills easily.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages