8

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

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78

3 Answers3

21

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

Abhay Prince
  • 2,032
  • 1
  • 15
  • 17
2

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

0

On a website that is based on a CMS engine like WordPress, for the case of the WordPress CMS, the page title will be the pre-filled message, which is very useful if you want to know from what website page/title the request is coming.

To create your own link with a pre-filled message that will automatically appear in the text field of a chat, use <a href="whatsapp://send?text= <?php the_title_attribute(); ?> &phone=:whatsappphonenumber </a>

Where: the_title_attribute(); is the WordPress Function retrieving or displaying the current title, and

whatsappphonenumber is the WhatsApp number used to receive the message.

enter image description here

Constantine
  • 650
  • 9
  • 15