Skip to content

Instantly share code, notes, and snippets.

@RonnyO
Last active September 10, 2022 07:52
Show Gist options
  • Save RonnyO/ae9267395cd7fda8ca73aad6a0bac257 to your computer and use it in GitHub Desktop.
Save RonnyO/ae9267395cd7fda8ca73aad6a0bac257 to your computer and use it in GitHub Desktop.
Message any number on WhatsApp - Bookmarklet
javascript:void%20function(){let%20a=prompt(%22Type%20a%20phone%20number%22,%22+972%22);a=a.replace(/^0/,%22+972%22).replace(`${%22+972%22}0`,%22+972%22).replace(/-/g,%22%22),window.open(%22https://wa.me/%22+a,%22_blank%22)}();
/*
Create a bookmark and paste the above `wa.me.bookmarklet.js` code as its url
Any international number with prefix, dashes etc. (+44-1234-567) or a simple Israeli number (0...) would work
If you tweak this, generate as a bookmarklet using https://chriszarate.github.io/bookmarkleter/
*/
const PREFIX = '+972';
let phone = prompt('Type a phone number', PREFIX);
phone = phone
.replace(/^0/, PREFIX)
.replace(`${PREFIX}0`, PREFIX)
.replace(/-/g, '');
window.open('https://wa.me/' + phone, '_blank');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment