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
regsvr32and 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
system32for 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.
ÐÑ‚Ð° Ð¸Ð½ÑÑ‚Ñ€ÑƒÐºÑ†Ð¸Ñ Ð¼Ð¾Ð¶ÐµÑ‚ Ð±Ñ‹Ñ‚ÑŒ Ð¿Ð¾Ð»ÐµÐ·Ð½Ð° Ð´Ð»Ñ Ñ‚ÐµÑ…, ÐºÑ‚Ð¾ Ð·Ð°Ñ…Ð¾Ñ‡ÐµÑ‚ Ð¿ÑƒÑ‚ÐµÐ¼
Ð½ÐµÑÐ»Ð¾Ð¶Ð½Ñ‹Ñ… Ð¼Ð°Ð½Ð¸Ð¿ÑƒÐ»ÑÑ†Ð¸Ð¹ Ð½Ð°ÑÑ‚Ñ€Ð¾Ð¸Ñ‚ÑŒ Ð¿Ñ€Ð¾Ð²ÐµÑ€ÐºÑƒ Ð±Ð°Ð»Ð°Ð½ÑÐ° ÑÑ‡ÐµÑ‚Ð° Ð¼Ð¾Ð±Ð¸Ð»ÑŒÐ½Ð¾Ð³Ð¾
Ð½Ð¾Ð¼ÐµÑ€Ð° ÐšÐ¸ÐµÐ²ÑÑ‚Ð°Ñ€ Ñ‚Ð°Ðº, Ñ‡Ñ‚Ð¾Ð±Ñ‹ Ð¾Ð½Ð° Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÑÐ»Ð°ÑÑŒ Ð°Ð²Ñ‚Ð¾Ð¼Ð°Ñ‚Ð¸Ñ‡ÐµÑÐºÐ¸, Ñ€ÐµÐ³ÑƒÐ»ÑÑ€Ð½Ð¾ Ð¸
Ð´Ð»Ñ Ð½ÐµÑÐºÐ¾Ð»ÑŒÐºÐ¸Ñ… ÑÑ‡ÐµÑ‚Ð¾Ð². Ð¢Ð°Ðº, Ñ‡Ñ‚Ð¾ ÐµÑÐ»Ð¸ Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ Ð¾Ð´Ð¸Ð½ Ð¸Ð· ÑÑ‡ÐµÑ‚Ð¾Ð² “ÑƒÑ…Ð¾Ð´Ð¸Ñ‚”
Ð½Ð¸Ð¶Ðµ Ð¿Ð¾Ñ€Ð¾Ð³Ð¾Ð²Ð¾Ð³Ð¾ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ, Ñ‡Ñ‚Ð¾Ð±Ñ‹ ÑÐ»ÐµÐ´Ð¾Ð²Ð°Ð»Ð¾ ÑƒÐ²ÐµÐ´Ð¾Ð¼Ð»ÐµÐ½Ð¸Ðµ Ð¾Ð± ÑÑ‚Ð¾Ð¼ Ð¿Ð¸ÑÑŒÐ¼Ð¾Ð¼
Ð”Ð»Ñ Ñ‚Ð¾Ð³Ð¾, Ñ‡Ñ‚Ð¾Ð±Ñ‹ Ð²Ñ‹Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÑŒ Ð½Ð°ÑÑ‚Ñ€Ð¾Ð¹ÐºÑƒ, Ð½ÐµÐ¾Ð±Ñ…Ð¾Ð´Ð¸Ð¼Ð¾ Ð·Ð°Ð³Ñ€ÑƒÐ·Ð¸Ñ‚ÑŒ Ð¸
Ð·Ð°Ñ€ÐµÐ³Ð¸ÑÑ‚Ñ€Ð¸Ñ€Ð¾Ð²Ð°Ñ‚ÑŒ Ð½ÐµÑÐºÐ¾Ð»ÑŒÐºÐ¾ Ñ„Ð°Ð¹Ð»Ð¾Ð² ÐºÐ°Ðº ÑÑ‚Ð¾ Ð¾Ð¿Ð¸ÑÐ°Ð½Ð¾ Ð²Ñ‹ÑˆÐµ, Ð° Ñ‚Ð°ÐºÐ¶Ðµ Ð¿Ð¾Ð´Ð¿Ñ€Ð°Ð²Ð¸Ñ‚ÑŒ
Ð½ÐµÐ±Ð¾Ð»ÑŒÑˆÐ¾Ð¹ ÑÑ†ÐµÐ½Ð°Ñ€Ð¸Ð¹ Ð¿Ñ€Ð¾Ð²ÐµÑ€ÐºÐ¸, ÑƒÐºÐ°Ð·Ð°Ð² Ñ‚Ð°Ð¼ Ð½Ð¾Ð¼ÐµÑ€Ð° Ð¸ Ð¿Ð°Ñ€Ð¾Ð»Ð¸ Ðº ÑÐ»ÑƒÐ¶Ð±Ðµ “ÐœÐ¾Ð¹
ÐšÐ¸ÐµÐ²ÑÑ‚Ð°Ñ€” Ð´Ð»Ñ ÑÑ‚Ð¸Ñ… Ð½Ð¾Ð¼ÐµÑ€Ð¾Ð².