4

I need to put a deep link in my HTML for adding a contact to the Phone and then begin a new conversation in whatsapp.

I found this code

<a href="whatsapp://send?text=Hello%2C%20World!">Send text to whatsapp</a>

And this one:

<a href="whatsapp://send?abid=username&text=Hello%2C%20World!">Send text to user</a>

I need to open a conversation with a specific contact even if I don't have the contact. My first question is, where can I get the username for whatsapp?

Having the abid I can try if it works but I dont know where to get that data.

Thanks a lot

Javier Torron Diaz
  • 347
  • 1
  • 4
  • 25

6 Answers6

9
<a href="https://api.whatsapp.com/send?phone=NUMBER">Send Message</a>

Without "+" or "00" at the beginning, just start country code and the number. Example USA is +12025599025 then in the code given, replace NUMBER with 12025599025

Stepan Novikov
  • 1,402
  • 12
  • 22
eddy
  • 106
  • 1
  • 1
6

this was worked for me:

whatsapp://send?text=MESSAGE&phone=+NUMERO&abid=+NUMERO

Obviusly "+NUMERO" is the wsp number and "MESSAGE" the preloaded message put in inhref` attribute

Malki Mohamed
  • 1,578
  • 2
  • 23
  • 40
  • In my case it seems that the number is not added, instead it attemps to send a message to a given number but does not add the contact to your phone (most likely for security reasons since whatsapp leverages the contacts repository of the smartphone). – Natalie Perret Jul 01 '18 at 10:39
2

Recent solution (July 2017)

Malki's answer does solves the issue, but recently there's been published an official Whatsapp API I mentioned in THIS OTHER ANSWER (because S.O. policies I had to put a link to the solution, no duplicates).

DavidTaubmann
  • 3,223
  • 2
  • 34
  • 43
2

This doesn't directly add the contact but allows you to open a copnversation with a concrete number, it can be very usefull to use it in your web sites. I've just found that it is possible to open a conversation to a number Using Click to Chat

To create your own link with a pre-filled message that will automatically appear in the text field of a chat, use https://wa.me/whatsappphonenumber/?text=urlencodedtext where whatsappphonenumber is a full phone number in international format and URL-encodedtext is the URL-encoded pre-filled message.

Example:https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale

NOTE: It opens WhastApp application if you click the link using a mobile phone browser (at least from Android)

Juan
  • 2,156
  • 18
  • 26
1

The ABID (address book ID) is for an ID, not a name on your contact list.

In Whatsapp URL Scheme Documentation There are not (yet) documentation to send message to a specific contact.

The best way i found is to add the contact using this html code:

<a href="tel:0123456789">add number</a>  

(this will open Contacts app from your phone)

0

This is how you can create a link to send a WhatsApp message to a particular number.

Notice that you don't need to add the '+' symbol before the country -code. Just start with the country-code followed by the WhatsApp number:

<a href="https://api.whatsapp.com/send?phone=919854098540" target="_blank">Link Icon</a>
hackernewbie
  • 1,606
  • 20
  • 13