Skip to content

Latest commit

 

History

History
113 lines (64 loc) · 4.25 KB

README.md

File metadata and controls

113 lines (64 loc) · 4.25 KB

WhatsApp Bot Go

Whatsapp Bot for CoWIN vaccination (with automated CAPTCHA verification)

This is absolutely for academic reference purposes only. Lagalities arising out of commercial or personal use is none of the concerns of the author(s) of this and/or any related repo

On your computer whatever number you logged in to WhatsApp with, by scanning the QR code, that number becomes the host. Any other mobile number who want to book, will need to send subscribe to the host whatsapp. After that, the bot will ask all the details it needs and begin polling the cowin server. When a slot is available, it will notify via whatsapp to the subscriber, send OTP and read CAPTCHA on its own before going ahead with booking. If the host wants to book for oneself, the host will also need to send subscribe message to itself.

WhatsApp Icon CoWIN Icon

Install

go get github.com/pkjmesra/whatsapp-bot

Getting Started on your PC/Mac

$ go build && go install && mv $GOPATH/bin/whatsapp-bot ./whatsapp-bot

$ ./whatsapp-bot -i 30
  • i gives the interval to ping and poll for available vaccination slots for a given set of parameters
  • m can help setup a specific mobile number for which you'd like to book an appointment via whatsapp

When you run, your mobile/whatsapp will become the host for sending/receiving data with [91MobileNumber].

  • On your mobile phone, launch whatsapp and send a "subscribe" message to yourself or ask your friend to send a "subscribe" message to your number. (The same number with which you've logged in into whatsapp-bot)

  • Every API call is automated for CoWIN.

  • OTP is sent to your mobile <91MobileNumber>. Enter it in whatsapp when prompted or follow the instructions below to automatically have it entered.

  • CAPTCHA will be sent on whatsapp itself. Enter CAPTCHA to proceed for appointment if not autodetected. In 95% of the cases, CAPTCHA will be autodetected and entered.

Entire transaction can be finished in : time taken for OTP + time taken for CAPTCHA (if not detected automatically).

Getting Started on Android

On your Android phone having the whatsapp running with the same number with which you logged in in the previous step, please do the following setup for OTP.

By using Tremux you can run script and receive the notification on your phone.

  • Install Termux

    Termux wiki suggest not to use playstore termux.
  • Installing Packages and Requirements

    • Step 1 : First update pkg

      pkg update
      
    • Step 2 : Install git

      pkg install git
      
    • Step 3 : Clone repo

      git clone https://github.com/pkjmesra/whatsapp-bot.git
      
    • Step 4 : Open Cloned Folder

      cd whatsapp-bot
      
    • Step 5: run install.sh

      bash install.sh
      
    • Step 6: run otp.py

      cd pkBot
      
      chmod +x otp.py
      
      python otp.py 91Your-Mobile-Number-Here-With-Which-You-Have-Launched-WhatsApp
      

When OTP is received, it will launch whatsapp on your mobile to send it to the number with which it was launched on the PC/Mac.

Now open Whatsapp on your Android and send type : subscribe and send it to the same number with which you have logged in on the whatsapp-bot on your Mac/PC.

Enjoy!

  • Subscribe to getting notified

  • Setting up your search parameters

  • Saving your search parameters and confirming

  • Receiving your registered beneficiaries

  • Receiving the notification when the slots become available

  • Trying to book the appointment and receive the confirmation or message if it could not be booked.

After launching, app will create a WhatsApp connection. If you are not logged in, it will print a QR code in the terminal. Scan it with your phone and you are ready to go!

Bot will remember the session (TempDir > pkBot > Session > WhatsappSession.gob) so there is no need to authenticate everytime.