Setting Up a Free WhatsApp OTP service with C#

Over time, One Time Password has become essential in building products that require users signing in and low-level user verification. Integrating this service is not only expensive but also might be difficult or unstable depending on the platform you decide to use.

They are various ways of achieving OTP service, but this writeup will be focusing on using WhatsApp and C#. The requirements for this exercise include

  1. A smartphone with WhatsApp
  2. Dotnet core SDK
  3. Visual Studio
  4. Basic knowledge of C#

Create a new .Net Core API Project

Create a “Model” folder with the following classes in  it

  1. Message
public class Message
   public string Contact { get; set; }
   public string Text { get; set; }
   public bool IsDigit()
       const string numbers = "0123456789";
       var count = (from ch in Contact
           where !numbers.Contains(ch)
           select ch).Count();
       var isNumber = (count == 0);
       return isNumber;
  1. WhatsAppMetadata
public class WhatsAppMetadata
   public static string MainPanel = "#pane-side";
   public static string SearchField = "._2S1VP";
   public static string UserChat = "#pane-side span[title=\"XXX\"]";
   public static string UserName = "#main > span[title=\"XXX\"]";
   public static string MessageInputField = "._2S1VP";

3. Install Puppeteer

Go to your nugget package manager and install PuppeterSharp. This package is used to crawl the web using C# and chro4me

4. Create a Service folder with a WhatsAppService class

  Add the following properties

This class have five important functions

  1. InitBrowser():  this function will download a chrome browser on the first run and start it
private async Task InitBrowser()
   Debug.WriteLine("Downloading. . .");
   await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
   _browser = await Puppeteer.LaunchAsync(new LaunchOptions()
       UserDataDir = Path.Combine(".", "user-data-dir"),
       Headless = false
   Debug.WriteLine("Browser downloaded. . .");
  1. InitWhatsApp(): This function will open a new tab and load the WhatsApp page requesting you to scan the barcode
private async void InitWhatsApp()
   var qrCodeAbsolutePath = _binPath.Replace("bin", "") + QrCodeImagePath;
   _whatsAppPage = await _browser.NewPageAsync();
   await _whatsAppPage.GoToAsync(WhatsAppUrl);
       await _whatsAppPage.WaitForSelectorAsync(WhatsAppMetadata.MainPanel);
   catch (Exception)
       Console.WriteLine("As a new User, you need to login");
       await _whatsAppPage.ScreenshotAsync(qrCodeAbsolutePath);
       Console.WriteLine($"send image in {qrCodeAbsolutePath} to your email && print to console");
       await _whatsAppPage.WaitForSelectorAsync(WhatsAppMetadata.MainPanel);
   await _whatsAppPage.ScreenshotAsync(qrCodeAbsolutePath);
  1. SendMessages(): This removes a message from or queue and sends with
private void SendMessages()
   while (_messages.Any())
       var message = _messages.Dequeue();
  1. SendMessage(Message message): This function is responsible for sending the selected message
private async void SendMessage(Message message)
  if (message.IsDigit())
       //load the new url and press send
       var url = NewContactUrl.Replace("<PHONE>", message.Contact).Replace("<MESSAGE>",message.Text);
       await _whatsAppPage.GoToAsync(url);
       await _whatsAppPage.WaitForSelectorAsync(WhatsAppMetadata.MessageInputField);
       await _whatsAppPage.Keyboard.PressAsync("Enter");
       //Message Sent
       Console.WriteLine("Message Sent");
   //Search complete
   var searchInput = await _whatsAppPage.QuerySelectorAsync(WhatsAppMetadata.SearchField);
   await searchInput.TypeAsync(message.Contact);
   await _whatsAppPage.WaitForTimeoutAsync(500);  
   var fiendLocation = WhatsAppMetadata.UserChat.Replace("XXX", message.Contact);
   var contactHandle = await _whatsAppPage.QuerySelectorAsync(fiendLocation);
   await contactHandle.ClickAsync();
   var messageSplit = message.Text.Split("\n");
   foreach (var word in messageSplit)
       await _whatsAppPage.Keyboard.DownAsync("Shift");
       await _whatsAppPage.Keyboard.PressAsync("Enter");
       await _whatsAppPage.Keyboard.UpAsync("Shift");
       await _whatsAppPage.Keyboard.TypeAsync(word);
   await _whatsAppPage.Keyboard.PressAsync("Enter");
  1. AddMessage(Message message): There’s is no direct method to call from an external class to send messages, instead this method is called to add a new message to an already existing queue.
public void AddMessage(Message message)
   if (_messages.Count == 1)

Go to your Startup.cs class and inject WhatsAppService as a singleton class

var whatAppService = new WhatsAppService();

With all this done, you can go ahead and use the WhatAppService in your controllers to send Messages (including users One Time Password)

KIN Developer Program; WiCrypt, the next big thing?

Cryptocurrencies or magic internet money, anything you wish to call it, is fast becoming the future of online trading. How long will it be in play??? That’s still a huge debate amongst developers but one thing is certain and that’s the need for more crypto-bound apps!

With increasing online transactions, there is a massive need for platforms enabling easy payment and receipt for services provided and also for swift transferability… Still wondering where WiCrypt comes in?

The Kin Developer Program, is a modelled initiative that will empower developers to successfully create KIN-powered apps, or build KIN-powered experiences into their existing apps with more than 200 developers from over 37 countries around the world proposing new and innovative use cases for KIN over the past few months, with WiCrypt, a product of Ugarsoft Limited being 1 out of the 40 selected finalists in the KIN Developer Program.

WiCrypt enables its users to get paid while sharing their WiFi (Now tell me what beats that, really!). The app is so unique, it allows peer-to-peer internet sharing, giving you your deserved reward for sharing your mobile data. Users can easily purchase a connection to a WiCrypt hotspot using KIN while the hosts will earn KIN in return for providing internet connection. And when you think it’s all over…BOOM! Users get to receive bonuses for high ratings from those who have used their internet connection. (Now I’m certain nothing beats that!).

WiCrypt (which by now I guess you already know is the first of its kind), leverages the Blockchain and allows users to receive payments per kilobyte of their WiFi data consumed by a beneficiary, allowing the user having the freedom to set desired price per kilobyte of data consumed.  The app which is an inbuilt wallet will verify the beneficiary has enough cryptocurrency to start using the service and automatically disconnects the beneficiary when the money is exhausted.

With WiCrypt, the problems of expensive internet services, unavailability of service from service providers at specific locations, unavailability of internet services for tourists and underutilization of abundant internet connection by Individuals/Companies that do not exhaust their excess data or have unlimited internet connection have all been solved.




Uber President Jeff Jones is leaving the company amid turmoil

Things just seemingly keep getting worse at Uber, which now is reportedly losing its president Jeff Jones according to Recode.

The departure comes amid a series of sexual harassment allegations as well as being hit by a lawsuit from Waymo — Alphabet’s self-driving car unit — that threatens to potentially kneecap its autonomous driving efforts. Uber CEO Travis Kalanick told employees he was planning on bringing on some parental supervision at the company in the form of a chief operating officer, but that doesn’t seem to be stopping the turmoil and affecting employee morale.

Uber confirmed the departure with the following statement: “We want to thank Jeff for his six months at the company and wish him all the best.”

Recode is reporting that the departure is directly related to the controversies at the company, which continue to mount and get worse. At the beginning of the year, people viewed that Uber was taking advantage of a major protest amid Donald Trump’s immigration ban. That spawned a whole #DeleteUber campaign, which once again flared up following explosive allegations of sexual harassment — and the embedded culture within the company that spawned it.

Its self-driving efforts are also facing a ton of scrutiny following allegations from Alphabet that the company is using stolen trade secrets. Alphabet is claiming that executives at Otto, a self-driving trucking unit Uber acquired, took trade secrets with them on their way out. That’s led to an already-fiery legal battle. Waymo filed for an injunction against Uber earlier this month.

The situation also seems to be increasingly deteriorating. Jones is not the only recent departure, with SVP of engineering and former Googler Amit Singhal leaving the company at the end of February. In just the span of a month, it already seems like the top of Uber’s organizational chart will soon look very different — though whether that will have a meaningful impact on Uber’s culture, or even the perception of its culture, is still unknown.

Update: Jones sent a statement about his departure to Recode

I joined Uber because of its Mission, and the challenge to build global capabilities that would help the company mature and thrive long-term.

It is now clear, however, that the beliefs and approach to leadership that have guided my career are inconsistent with what I saw and experienced at Uber, and I can no longer continue as president of the ride sharing business.

There are thousands of amazing people at the company, and I truly wish everyone well.

Meanwhile, Uber CEO Travis Kalanick sent the following letter to Uber staff:


I wanted to let you know that Jeff Jones has decided to resign from Uber.

Jeff joined Uber in October 2016 from being CMO at retailer Target. In 6 months, he made an important impact on the company—from his focus on being driver obsessed to delivering our first brand reputation study, which will help set our course in the coming months and year.

After we announced our intention to hire a COO, Jeff came to the tough decision that he doesn’t see his future at Uber. It is unfortunate that this was announced through the press but I thought it was important to send all of you an email before providing comment publicly.

Rachel, Pierre and Mac will continue to lead the Global Ops teams, reporting to me until we have signed a COO. Troy Stevenson, who leads CommOps, and Shalin Amin who leads brand design will report to Rachel Holt. Ab Gupta will report to Andrew MacDonald.