Headless automation script to scrape bills, calculate monthly bills (utilities & installments) and generate a text message which is later sent to desired whatsapp recipients.
It is not guaranteed that the automation can run on different platforms, but it isn't guaranteed that it would not be able to run either. If you are using an older/later python version or different Linux distro/version but it still runs, you're good to go!
*Bill September 2023*
Utilities: Elektrik = RM87.85 Air = RM34.85 Unifi = RM168.55 Sewa = RM1000
Installments: Credit card (Washing Machine) = RM193.17
Total per person = RM1484.42/5 = RM296.88
6. In this latest version of automation where it uses a private API, the message generated in Step 5.
## GitHub Actions
As of v0.1, the automation supports execution on **GitHub Actions**. There are 4 workflows, each of their .yml file in the .github/workflows directory:
- Dev branch build & test (build-dev-branch.yml)
- Triggered on every push to the dev branch.
- Master branch build & test (build-master.yml)
- Triggered on every pull request to the master branch.
- Master branch cron job tests (cron-master-test.yml)
- Scheduled to run every 5 days at 9.00am (GMT+0 time).
- Master branch main cron job (cron-master-main.yml)
- Scheduled to run on the 1st day of every month at 9.00am (GMT+0 time).
## Setup
1. Create a .env file with the following details:
TNB_EMAIL=[your TNB account email] TNB_PASSWORD=[your TNB account password] AIR_EMAIL=[your Air Selangor account email] AIR_PASSWORD=[your Air Selangor account password] mynum=[your Whatsapp phone number] ws_group_id=[your whatsapp group id] DB_URI=[ remote postgresql instance connection string URI/URL ] DB_USERNAME=[ remote postgresql instance username ] DB_PASSWORD=[ remote postgresql instance user password ] DB_HOST=[ remote postgresql instance host name ] DB_PORT=[ remote postgresql instance port ] DB_DATABASE=[ remote postgresql instance default database for the automation ] SUPABASE_API_URL=[ your supabase project API URL ] SUPABASE_ANON_KEY=[ your supabase project anon key ]
Replace the placeholder details with your details. Make sure the remove the squared brackets, and leave no spaces
between the equals and your written details, e.g. `TNB_EMAIL=myemail@email.com`.
To find the ID of a whatsapp group, refer to [this](https://www.alphr.com/whatsapp-find-group/) link.
To find your supabase postgresql database credentials, refer to [this](https://supabase.com/docs/guides/database/connecting-to-postgres) link. Make sure to create an account first.
2. Run `./setup.sh` to install dependencies. (run `chmod u+x setup.sh` first if encountered permission problems)
## Execution
Run `./runner.sh` to execute the program. (run the chmod command if permission denied)
**NOTE**: You would most likely need to login to whatsapp web the first time you execute the program to link your
whatsapp account to Ubuntu's Google Chrome.