Send a message to Whatsapp from a web page?

5

We are in the middle of a website development for a bakery, and within the requirements that the analysts gave us, he asks us for the following: "Confirm orders first by registering the client and then sending an email or a message by whatsApp to the administrator of the page." The part that we are a little behind is in WhatsApp. Is it possible to do that from a web page? From a contact that has not registered. Thanks

    
asked by Felipe Flores 15.07.2016 в 06:42
source

2 answers

1

There goes the code with styles. You add it wherever you want and it works:

<a href="intent://send/+34xxxxxxxxx#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end" style="font-size:20px;padding:5px 12px;border-radius:5px;background-color:#189D0E;color:white;text-shadow:none;"> ›› Mensaje de WhatsApp </a>
    
answered by 01.02.2017 в 13:26
-3

You can Try in these ways. (Only mobiles with What's app)

  document.querySelector('#send_message').addEventListener('click',function(){

    var message = document.querySelector('#mensaje').value;
    var number = document.querySelector('#number').value;
    
    var url = "whatsapp://send?text="+encodeURIComponent(message)+"&phone="+encodeURIComponent(number)

    window.open(url);
    
  });
Opcion 1 <br><br>
Texto
<input type="text"  name="send"  value="Hola mundo" id="mensaje" /> <br>
Numero
<input type="text"  name="number"  placeholder="ingresa el numero" id="number" />
<br /><br>
<button  id="send_message">Enviar mensaje</button>

<br />
<br />
<br />
<br />
Prueba Rapida
<a href="whatsapp://send?text=Hola Mundo&phone=+18298615386">Enviar mensaje</a>

link

    
answered by 15.07.2016 в 06:56