Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Whatsapp message box on button click on a web page

Tags:

html

whatsapp

I have added some logos at the end of my website. I want to open respective apps based on the logos when clicked by users. This menu is shown when the user accesses the site via mobile

How can I open whatsapp message for a particular number when user clicks on it?

For example for email we have mailto and for telephone we have tel

enter image description here

like image 437
Danyal Sandeelo Avatar asked Jun 06 '18 12:06

Danyal Sandeelo


People also ask

How can I open WhatsApp on button click?

Click to chat works on both your phone and WhatsApp Web. Use https://wa.me/<number> where the <number> is a full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format. The pre-filled message will automatically appear in the text field of a chat.

How do you link WhatsApp to HTML?

whatsapp link html // Use https://wa.me/<number> where the <number> is a full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format.


2 Answers

You can use href of this element to

 <a href="whatsapp://send?text=WHATEVER_LINK_OR_TEXT_YOU_WANT_TO_SEND" title="Share on whatsapp">WhatsApp</a>

For a specific number

 href="//api.whatsapp.com/send?phone=91MOBILE_NUMBER&text=WHATEVER_LINK_OR_TEXT_YOU_WANT_TO_SEND"

Please make sure in phone, there is CountryCode 91 for India

like image 106
Abhay Prince Avatar answered Oct 16 '22 16:10

Abhay Prince


They have a function called Click to Chat which I have tested in standard banners.

WhatsApp's Click to Chat feature allows you to begin a chat with someone without having their phone number saved in your phone's address book. As long as you know this person’s phone number, you can create a link that will allow you to start a chat with them. By clicking the link, a chat with the person automatically opens. Click to Chat works on both your phone and WhatsApp Web.

  1. You can create a click to WhatsApp Number (Do note the mobile number needs to have an Active Whatsapp Account)
  2. You can have a click to WhatsApp with Pre-Filled Message
  3. You can click to just a Pre-Filled message. It would then prompt you to select a contact.

Works on web, mobile web and mobile apps

Example of clicthrough URL - https://wa.me/0123456789?text=I'm%20interested%20in%20your%20car%20for%20sale

More info here: https://faq.whatsapp.com/en/android/26000030/

Adding international contacts/phone numbers: https://faq.whatsapp.com/en/general/21016748

like image 2
Abduraghmaan Van Oordt Avatar answered Oct 16 '22 16:10

Abduraghmaan Van Oordt