cowin-cli is a simple cli tool to book vaccines and list centers using the COWIN API.
Note: By default cowin-cli will not run continoulsy and monitor slot changes, use bash / batch scripts for that purpose, which can be found here.
go get
$ go get -u github.com/anoop142/cowin-cli
Note : go version 1.16+ is required.
OR
Precompiled binaries are avalailable for Windows, macOS and linux. Download them at Releases page.
Follow these steps to set up in termux.
# Install packages
$ pkg i golang git
# Add go bin to PATH
$ echo -e "export GOPATH=$HOME/go\nexport PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> ~/.bashrc
$ source ~/.bashrc
# Install cowin-cli
$ go get -u github.com/anoop142/cowin-cli
There are two main modes
cowin-cli -s state -d district [-v vaccine1,vaccine2] [-m age] [-i] [-b] [-c dd-mm-yyyy] [-dose dose] [-t freeType] [-ms minimumSlot] [-p] [-ncb]
$ cowin-cli -s kerala -d alappuzha
Thazhakara PHC
Kayamkulam THQH
$ cowin-cli -s kerala -d alappuzha -i -m 45 -v "covaxin,covishield" -b -dose 1 -t free -ms 2
Kalavoor PHC Free 18-05-2021 11 COVAXIN 45 Dose-1
Vandanam MCH Free 18-05-2021 4 COVISHIELD 45 Dose-1
Mannanchery PHC Free 18-05-2021 7 COVISHIELD 45 Dose-1
The -i
option displays all extra info like date, vaccine name, age...
-b'
prints only bookable centers.
-p
make use the protected URL to list.
-ms
sets minimum slot , here show centers having min 2 slots available for booking.
You can specify mobile number, centers to auto book, age, name etc. If not, you will be prompted to enter it appropriately.
$ cowin-cli -sc -s state -d district [-no mobileNumber] [-v vaccine1,vaccine2] [-names name1,name2] [-centers center1,cetner2 ] [-slot slotTime] [-ntok] [-dose dose] [-t freeType] [-ms minimumSlot] [-ncb]
$ cowin-cli -sc -s kerala -d alappuzha -no 9123456780
+----+---------------+-----------+---------+-----------+------+
| ID | CENTER | FREE TYPE | MIN AGE | VACCINE | DOSE |
+----+---------------+-----------+---------+-----------+------+
| 0 | Aroor FHC | Free | 45 | COVISHIELD| 1 |
| 1 | Ala PHC | Free | 45 | COVISHIELD| 1 |
| 2 | Kalavoor PHC | Free | 45 | COVISHIELD| 2 |
+----+---------------+-----------+---------+-----------+------+
Enter Center ID : 1
Enter OTP : xxxxx
+----+---------------+
| ID | NAME |
+----+---------------+
| 0 | John doe |
| 1 | Jane doe |
| 2 | Somebody
| 3 | All |
+----+---------------+
Enter name ID : 1,2
Appointment scheduled successfully!
Note: By default cowin-cli will reuse token, so until the token expires , you don't need to enter otp again.
you can specify most of the details for booking the vaccine
$ cowin-cli -sc -s kerala -d alappuzha -no 9123456780 -names "John doe, Jane doe" -centers "Aroor FHC,Ala PHC" -v "covaxin,sputnik v" -dose 2 -t free -ms 2
Center : Aroor FHC COVAXIN Dose-2
Enter OTP : xxxxx
Note: -centers "any" to auto select any center. -name "all" to book for all under same mobile no.
Scripts are available for notifying and booking using cowin-cli here. You need to edit the vaules of the script like district name, mobile number etc..
Note: This is meant for advanced users.
It's possible to detect OTP message and get OTP in Termux without user input. use -aotp flag to invoke this feature.
You need to first setup termux to read sms.
1.Install Termux API apk from Fdroid here
2.Install termux-api package
3.Pass flag -aotp
# Install termux-api package
$ pkg i termux-api
# To give permisiion
$ termux-sms-list
# Example
$ cowin-cli -s kerala -d alappuzha -sc -no 9123456789 -aotp
Tokens are always written to "token.txt" after successfully validating OTP to use it for listing or booking.
You can generate token manually using the token generation mode.
cowin-cli -gen [-no MobileNumber] [-token tokenFile]
$ cowin-cli -gen -no 9123456789
Enter OTP :xxxxxx
Written to token.txt
-s state State Name
-d district District name
-version Show version
-h Show Help
-b
show bookable only
-c string
date dd-mm-yyyy (default tomorrow's date)
-i
full info
-v string
vaccine names separated by ','
-m int
age
-dose int
dose type
-t string
free type
-p
use protected URL to list
-ms int
minimum slots (default 1)
-ncb
don't use cache bypass
-sc
invoke schedule vaccine mode
-names string separated by ','
beneficiaries name
-no string
mobile number
-centers string separated by ','
centers to auto select
-m int
min age limit
-slot string
slot time
-v string
vaccine names separated by ','
-ntok
don't reuse token
-dose int
dose type
-token string
file to read/write token (default "token.txt")
-t string
free type
-aotp
auto capture otp for termux
-ms int
minimum slots (default 1)
-ncb
don't use cache bypass
-gen
invoke token generation mode
-token string
file to read/write token (default "token.txt")
-no int
mobile number
GPL 3.0
Copyright (c) Anoop S