A simple way to start a chat with a non-phonebook WhatsApp contact.

This is a draft post. Find out more about what that means. Get in touch if this post could use an improvement.

This is a part of the 100 Days To Offload challenge.

I wrote this bookmarklet to start a chat with a non-phonebook WhatsApp contact… a long time back. I prefer to use this instead of those third-party services that are also essentially doing the same thing but with the over-head of trusting them.

javascript: (function () {
  var url = "https://web.whatsapp.com/send?phone=";
  var phoneNumber = prompt("Enter a phone number (with the country code):");
  window.open(url + phoneNumber);
})();

You can drag this link into your bookmarks toolbar instead if you’d like, and then give it a name of your choice if you’d like: Start a WhatsApp chat.

For mobile usage.

Bhavin Gandhi uses a small tweak to have this function on mobile: the web subdomain changes to api:

Right now I have bookmarked the api.whatsapp.com/send?phone= URL and I add phone number to it before visiting that site. [It] gives [me an] option to launch WhatsApp.

Bhavin on Mastodon on June 9, 2021

The corresponding bookmarklet, then, becomes:

javascript: (function () {
  var url = "https://api.whatsapp.com/send?phone=";
  var phoneNumber = prompt("Enter a phone number (with the country code):");
  window.open(url + phoneNumber);
})();

Joel also has a smart tip:

I actually added the URL to the keyboard dictionary, a few letters and the suggestion appears. I used your original code and changed “web” with “api”

Joel on Mastodon on June 9, 2021

It’s not often I need this, but it’s nice when for those rare moments you do.

Last updated on June 14, 2021. Join the discussion on Mastodon or Twitter, or write me an email.