8

Im building a website in php , i would like to implement whatsapp share button in it .I searched the internet for a while but couldn't find anything can any one explain how it works and how can i implement

Thanks in advance

Faizal Hussain
  • 1,551
  • 2
  • 10
  • 18

2 Answers2

31

UPDATE

A simplified version of the below URL is, here number and text are optional

https://wa.me/91XXXXXXXXXX?text=urlencodedtext

<a href="https://wa.me/91XXXXXXXXXX?text=urlencodedtext" target="_blank">WA</a>

This might help you

<a href="https://api.whatsapp.com/send?phone=91XXXXXXXXXX&text=urlencodedtext" target="_blank">WA</a>

phone and text parameters are not mandatory

this works in the mobile browser and pc browser, in pc this will open https://web.whatsapp.com/

I think this might be a better solution.

Dhanu K
  • 11,288
  • 6
  • 24
  • 38
14

Please note that this only works with mobile devices and mobile browsers

use this to share in whatsapp, text= The text to share / link / or anything; if you are using url, dont forget to encode it

<a href="whatsapp://send?text=The text to share!" data-action="share/whatsapp/share">Share via Whatsapp</a>
psyborg.eth
  • 310
  • 5
  • 18
Akhil Aravind
  • 5,741
  • 16
  • 35