Everyone has a cell phone nowadays, a lot of people have 2+ numbers, many have dependents with cell phones. In this country with prepaid services being so popular the number of people who pay for cellular phone services for several numbers perhaps exceeds one million. It looks obvious that there is certain demand for a service to access multiple accounts and consolidate balances at ones fingertips to be able to top them up timely.
The idea itself is not new, there have been various apps to gather the information, however the companies seem to be ignoring this request. I have five numbers with Kyivstar which I want to keep in good standing and the best the company can offer is the website where I can log in and out interactively to query the stats one by one.
It definitely stopped being fun at some point (it was certainly one of those days when important number hit the bottom when it was not expected to) and I had to delegate the checks to an automated script. The challenge is merely simple: there is a website, one need to log in, automated, get the data of interest, and then a few times again. Below are a few steps a power user might do to set up automated balance querying.
- First of all, there is an inproc COM server that implements the HTTP requests to My Kyivstar website. Pre-built UaMobileTools.dll is available from repository, so does the [partial] source code. The DLL has to be registered with
regsvr32 and it is ready to serve. Effectively, it implements two HTTP requests to authenticate, and then obtain and parse web page with current balance and other account statement data (the relevant part of the source code is here).
- Because the items below are going to involve sending an email to notify of low balance, one needs to similarly install and additional DLL to provide simple SMTP email services to scripting environment. The DLL is EmailTools.dll which also needs to be downloaded and registered. It was mentioned separately a while ago.
- Next part is setting up automation script that does the querying. The COM server in item 1 above is the implementation of the requests, but it needs to be automated.
I prepared a template of the .JS script that performs the checks.
The script is Check – Template.js and can be basically used as is, with only putting numbers of interest and respective passwords from My Kyivstar service. The part to be updated manually and individually is around line 54:
Do("Ann", "+380961111111", "password at my.kyvstar.ua", 10);
Do("Bill", "+380962222222", "password at my.kyvstar.ua", 20);
Do("Celine", "+380963333333", "password at my.kyvstar.ua", 30);
Do("Diana", "+380964444444", "password at my.kyvstar.ua", 40);
Where the items within the brackets are, respectively, friendly name, number, password and balance threshold for notification.
Should any of the numbers have balance below the respective threshold, the script composes and sends an email with all balances on the body. I personally have it routed to both real mailbox, and SMS gate at
firstname.lastname@example.org so I have the notification delivered to both destinations. Email settings are also on the script.
- Now when checking script is implemented and ready, Windows Task Manager is here to run it on schedule. I have it running twice a day, morning and evening. The data is also being written into log file, and should there be a need for topping up – I have an email, and I have an SMS message. Task Scheduler only needs to run
C:\Windows\syswow64\cscript.exe (might be
system32 for 32-bit OS) with a full path to .JS script as an argument.
Happy being on top of when to top the thing up.
An excerpt in Russian for those who might want it that way.
Эта инструкция может быть полезна для тех, кто захочет путем
несложных манипуляций настроить проверку баланса счета мобильного
номера Киевстар так, чтобы она выполнялась автоматически, регулярно и
для нескольких счетов. Так, что если хотя бы один из счетов “уходит”
ниже порогового значения, чтобы следовало уведомление об этом письмом
Для того, чтобы выполнить настройку, необходимо загрузить и
зарегистрировать несколько файлов как это описано выше, а также подправить
небольшой сценарий проверки, указав там номера и пароли к службе “Мой
Киевстар” для этих номеров.