Skip to content

Instantly share code, notes, and snippets.

@pauloeli
Last active February 21, 2023 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauloeli/91250dc98c42f3197c3f15382a2120f0 to your computer and use it in GitHub Desktop.
Save pauloeli/91250dc98c42f3197c3f15382a2120f0 to your computer and use it in GitHub Desktop.
Start new chat direct phone number (WhatsApp)

Useful for start a new chat in WhatsApp Web inputing a phone number.

// ==UserScript==
// @name         Start new chat direct phone number
// @namespace    tools
// @version      0.1
// @description  Start a new chat directly inputing the number
// @author       user
// @match        https://web.whatsapp.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=whatsapp.com
// @grant        none
// @run-at       context-menu
// ==/UserScript==

(function() {
    'use strict';

    let phone = prompt("Phone number:");
    if (!phone) {
      return
    }
  
  	const link = document.createElement("a");
  	link.setAttribute("href", `whatsapp://send?phone=${phone}`);
  	
  	document.body.append(link);
  	
  	link.click();

	document.body.removeChild(link);

})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment