Add Whatsapp function to website, like sms, tel
Asked Answered
A

7

50

I have a website that a lot of people view on mobile. I have link for : Call and SMS and I want to add one for Whatsapp, so a user can click the whatsapp link I create and start a conversation with me.

If this is possible can someone point me in the right direction on how?

Artistic answered 30/1, 2014 at 8:54 Comment(1)
Possible duplicate of Web link to specific whatsapp contactTallow
C
36

below link will open the whatsapp. Here "0123456789" is the contact of the person you want to communicate with.

href="intent://send/0123456789#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end">
Copperplate answered 3/2, 2015 at 6:49 Comment(2)
Well this worked for me, It opens Whatsapp message box of the contact number you added.Fawcette
this is working fine for Android, but not for IOS. do you have any idea on the code for IOS? whatsapp://send?abid=[address book id]&text=Hello%2C%20World! this seem to be the code for IOS, but too look for the address book id in website is seem to be impossible,Sera
S
20

Check this link out Launching Your iPhone App Via Custom URL Scheme

and more on the whats up url scheme document

I did a quick mock up and tried it on my iphone with a link like this from a webpage and it opened the app on my iphone.

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

I could not try to send a message as I don't have a current Whatsapp account sorry.

Add user name using abid parameter

let's say your whatsapp username was username then it would be

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

once again sorry I can't test this. Also I have no idea what would happen if the username is the actual user of the current mobile device. eg. You try to whatsapp yourself.

Similar answered 30/1, 2014 at 9:25 Comment(5)
Thanks. I just tried it and on my android doesnt do anything. Am I suppose to change anything in the link to reflect the phone number the message goes to?Artistic
Thanks. Im trying to figure out what my username is. Cant just be my display name. Im trying to figure it out f theres a unique name or something. I tried phone number but that didnt work.Artistic
On android does it open the app because there needs to be something setup called an intent on android this is setup by the whatsapp developers and I cannot find if they have set it up as whatsapp or not. Also like I mentioned before I have no idea what happens if it links to yourself so maybe get a friend to use the link on their device.Similar
im using the phone number for the username. so far it opens a browser window with whatsapp://send********* in the address barArtistic
FYI, just tried in Samsung S3 with Android 4.3, it jump to whatapps after clicking the link and let me choose the target audience to share.Farmstead
C
17

Here is the solution to your problem! You just need to use this format:

<a href="https://api.whatsapp.com/send?phone=whatsappphonenumber&text=urlencodedtext"></a>

In the place of "urlencodedtext" you need to keep the content in Url-encode format.

UPDATE-- Use this from now(Nov-2018)

<a href="https://wa.me/whatsappphonenumber/?text=urlencodedtext"></a>

Use: https://wa.me/15551234567

Don't use: https://wa.me/+001-(555)1234567

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

To create a link with just a pre-filled message, use https://wa.me/?text=urlencodedtext

Example:https://wa.me/?text=I'm%20inquiring%20about%20the%20apartment%20listing

After clicking on the link, you will be shown a list of contacts you can send your message to.

For more information, see https://www.whatsapp.com/faq/en/general/26000030

Carbineer answered 1/5, 2017 at 16:27 Comment(1)
The address wasn’t understoodRexferd
E
2

This is possible by creating the following link:

whatsapp://send?text=Hello this has been opened from the browser&phone=+PHONENUMBER&abid=+PHONENUMBER

Thanks to:

https://forum.ionicframework.com/t/open-whatsapp-intent-with-msg-specific-contact/73903/4

I have tested this on iOS, Windows Phone and Android

Elora answered 30/3, 2017 at 9:40 Comment(0)
A
2

I just posted an answer on a thread similiar to this here https://mcmap.net/q/149547/-web-link-to-specific-whatsapp-contact

The approach with:

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

and with

<a href="intent://send/0123456789#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end">whatsapp</a>

Only works if the person who clicked on your link have your number on their contact list.

Since not everybody will have it, the other solution is to use Whatsapp API like this:

<a href="https://api.whatsapp.com/send?phone=15551234567">Send Message</a>
Acculturation answered 11/4, 2017 at 22:39 Comment(0)
S
1

Use:

https://wa.me/YOURNUMBER

where YOURNUMBER is without the two leading 00.

For instance for +37061204312 you write:

https://wa.me/37061204312

This link seems to work on mobiles and on desktop computers.

To prefill the message with text you can use:

https://wa.me/YOURNUMBER/?text=urlencodedtext

More in the Whatsapp FAQ: https://faq.whatsapp.com/en/android/26000030/

Spritsail answered 12/9, 2018 at 10:54 Comment(0)
P
0

Rahul's answer gives me an error: You seem to be trying to send a WhatsApp message to a phone number that is not registered with WhatsApp..., even though I'm sending it to a registered WhatsApp number.

This, however works:

<li><a href="intent:0123456789#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end"><i class="fa fa-whatsapp"></i>+237 655 421 621</li>
Protohistory answered 26/4, 2017 at 10:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.