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
Send text to whatsapp
And this one:
Send text to user
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
Send Message
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
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
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).
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)
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:
add number
(this will open Contacts app from your phone)
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:
Link Icon
I am having an issue submitting with my form which I have built using jquery mobile and uploaded onto my android tablet using Phonegap build.
The script I am using is
<script>
function formSubmit()
{
document.getElementById("SiteVisit").action ="mailto:pja#bresnan.net?cc=" + document.getElementById("COC_Received_By").value + "&subject=Site%20Visit%20Form";
document.getElementById("SiteVisit").submit();
}
</script>
<form method="post" enctype="text/plain" name="SiteVisit" id="SiteVisit">
I keep getting an Application Error that "The Protocol isn't Supported"
I am not real code savvy...can someone please help me out with this one
I don't think you can just submit a form like this. Usually, on a normal web browser, you can't - you need the browser to be configured to use email. This is likely a browser configuration issue.
If you want things sent by email you can use one of the email plugins for PGB.
You set up your form to send its information to the email program. There are two ways to do it - 1. the user fills in a form and when they click Send all the info is sent to the email app and the user has to click Send again. 2. You just have the email option.
I use version 1 because, as it's a form, you can have the email pre-populated with the options from the Form. E.g. If you have a star rating you can pass the value from the form to the email. The heading of the email, for example, would be "Service Rating 5/5" or "Service Rating 3/5". Iyswim.
I have developed a website which is mainly used in mobile phones.
I want to allow users to share information directly from the web page into WhatsApp.
Using UserAgent detection I can distinguish between Android and iOS.
I was able to discover that in order to implement the above in iOS I can use the URL:
href="whatsapp://send?text=http://www.example.com"
I'm still looking for the solution to be used when the OS is Android (as the above doesn't work).
I guess it is somehow related to using "intent" in Android, but I couldn't figure out how to do it as parameter for href.
Just saw it on a website and seems to work on latest Android with latest chrome and whatsapp now too! Give the link a new shot!
Share via Whatsapp
Rechecked it today (17th April 2015):
Works for me on iOS 8 (iPhone 6, latest versions) Android 5 (Nexus 5, latest versions).
It also works on Windows Phone.
The above answers are bit outdated. Although those method work, but by using below method, you can share any text to a predefined number. The below method works for android, WhatsApp web, IOS etc.
You just need to use this format:
UPDATE-- Use this from now(Nov-2018)
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
Currently, it's very easy to achieve this. You only need to add the following code to your pages:
Share via Whatsapp
And that's it. No Javascript needed, nothing else needed. Of course you can style it as you want and include a nice Whatsapp icon.
I tested this in my Android device with Google Chrome. The versions:
Android 4.1.2 (Jelly Bean)
Chrome Mobile 37.0.2062.117. Also tested on Firefox Mobile 31.0.
Whatsapp V 2.11.399
It also works on iOS. I've made a quick test on an iPhone 5 with Safari and it works as well.
Hope this helps someone. :-)
According to the new documentation, the link is now:
Share this
If it doesn't work, try this one :
Share this
The official docs say to use: wa.me. Don't use wa.me. I apologize for the length of these results, but it's been a rapidly-evolving issue....
April, 2020 Results
Share Link
This link is incorrect. Close this window and try a different link.
May, 2020 Results
Share Link GitHub Ticket: WhatsApp short link without phone number not working anymore
We couldn't find the page you were looking for
Looks like you're looking for a page that doesn't exist. Or a page we might have just deleted. Either way, go back or be sure to check the url, your spelling and try again.
August, 2020 Results
Share Link
Works as expected!
LATEST - October, 2020 Results
Share Link
(Broken again!) og:image tag previews are disabled when using wa.me.
Based on some of the comments I'm seeing, it seems like this still be an intermittent problem, so, going forward, I recommend you stick to the api.whatsapp.com URL!
If you want to share, you must absolutely use one of the two following URL formats:
https://api.whatsapp.com/send?text=YourShareTextHere
https://api.whatsapp.com/send?text=YourShareTextHere&phone=123
If you are interested in watching a project that keeps track of these URLs, then check us out!: https://github.com/bradvin/social-share-urls#whatsapp
Recently WhatsApp updated on its official website that we need to use
this HTML tag in order to make it shareable to mobile sites:
Hello, world!
You can replace text= to have your link or any text content
LATEST UPDATE
Now you can use the latest API from whatsapp https://wa.me/ without worrying about the user agent, the API will do the user agent handling.
Share pre-filled text with contact selection option in respective whatsapp client (Android / iOS / Webapp):
https://wa.me/?text=urlencodedtext
Open Chat Dialog for a particular whatsapp user in respective whatsapp client (Android / iOS / Webapp):
https://wa.me/whatsappphonenumber
Share pre-filled text with a particular user (Combine above two):
https://wa.me/whatsappphonenumber/?text=urlencodedtext
Note : whatsappphonenumber should be full phone number in international format. Omit any zeroes, brackets or dashes when adding the phone number in international format.
For official documentation visit https://faq.whatsapp.com/en/general/26000030
I'm afraid that WhatsApp for Android does not currently support to be called from a web browser.
I had the same requirement for my current project, and since I couldn't find any proper information I ended up downloading the APK file.
In Android, if an application wants to be called from a web browser, it needs to define an Activity with the category android.intent.category.BROWSABLE.
You can find more information about this here: https://developers.google.com/chrome/mobile/docs/intents
If you take a look to the WhatsApp AndroidManifest.xml file, the only Activiy with category BROWSABLE is this one:
<activity android:name="com.whatsapp.Conversation" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
</activity>
I've been playing with it for a while, and I couldn't make it to work. The most I got was to open the WhatsApp application from Chrome, but I couldn't figure out a way to set the message content and recipient.
Since it is not documented by the WhatsApp team, I think this is still work in progress. It looks like in the future WhatsApp will handle SMS too.
The only way to get more information is by reaching the WhatsApp dev team, what I tried, but I'm still waiting for a response.
Regards!
In general it makes sense only to display the Whatsapp Link on iOS or Android Devices only, using java script:
if (navigator.userAgent.match(/iPhone|Android/i)) {
document.write('Share on WhatApp');
}
Just tested the whatsapp:// scheme on my super old Android 2.3.3 with Whats App 2.11.301, works like a charm. It seems to be just the Whats App version. Since Whats App is forcing everyone to update, it should be safe to use it.
The Whats App documentation also mention that scheme: http://www.whatsapp.com/faq/en/android/28000012
I'm using this on a production site now and will update here, if I get any user complaints.
Edit (Nov 14): No user complaints after a couple of weeks.
Switch the whatsapp share links according to the platform whether desktop or mobile.
This works with or without providing the phone number in the link.
For Mobile
vm.LinkTextToShare = 'https://api.whatsapp.com/send?text=' + encodeURIComponent(window.location.href) ;
window.open(vm.LinkTextToShare,"_blank");
For Desktop
vm.LinkTextToShare = 'https://web.whatsapp.com/send?l=en&text=' + encodeURIComponent(window.location.href) ;
window.open(vm.LinkTextToShare,"_blank");
This code worked for me.
After clicking on the link, it will ask you to choose the contact to share a message.
Click here to share on Whatsapp
You can add target="_blank" attribute to open it in a new window or tab.
I don't think the phone number is needed when someone wants to share a particular message or article.
use it like "whatsapp://send?text=" + encodeURIComponent(your text goes here), it will definitely work.
This is correct if you want to open whatsapp in browser:
<a href=`https://web.whatsapp.com/send?text=${yout URL or TEXT}` ><Whatsapp</a>
Try to make it this way:
Link
Even you can send messages without enter the phone number in the link:
Say hello
After clicking on the link, you will be shown a list of contacts you can send your message to.
More info in https://faq.whatsapp.com/en/general/26000030.
Good luck!
Use: https://wa.me/1XXXXXXXXXX
Don't use: https://wa.me/+001-(XXX)XXXXXXX
The pre-filled message 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 urlencodedtext is the URL-encoded pre-filled message.
Example:
https://wa.me/1XXXXXXXXXX?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’ll be shown a list of contacts you can send your message to.
I want to enable users to share a URL+ text with a WhatsApp group. I want this to work both from iPhones and Androids. However my app is in a browser (it's a website). I'm currently looking into 2 options, but both have issues:
1) The first potential solution - sharing directly from the browser.
I checked out WhatsApp's URL schema and used the following URL to share through my app:
"whatsapp://send?text=Hello%2C%20World!"
However there were several problems with this approach:
It seems to work only with iPhones and not with Androids. Is there a comparable solution somewhere for Androids?
It enables to choose who to send to only after you are redirected to WhatsApp, unless you know the address book ID (=abid) of the user. First, I do not know how to access the abid of users? Second, I am trying to send to a group, in which case there is no abid (right?), and therefore it seems impossible to do this. Is that true?
Also, what happens for Android apps? What is the comparable to the abid, for a group, and how do I get it?
2) The second potential solution - creating a native app which is identical with the browser-based app, but this specific part (where we do the "sharing") is native.
However, it seems to me that in this case I have very similar problems to the ones described above:
I can see how to do this for iOS on WhatsApp's website (see the link above). However, does the WhatsApp URL schema work with Android native apps as well?
Again, the address book ID issue is the same. How do I get it? It may be easier to get the abid on iOS given that we are now a native app, but does it exist for a group? And how about the Android app? Would this share to WhatsApp group work there?
Sharing directly from the browser works both in iPhone and Android if you use WhatsApp version 2.11 or higher. As you said it DIDN'T USED TO work in Android.
U can use the same URL
"whatsapp://send?text=Hello%2C%20World!"
Knowing abid is not possible as far as I know.
Hope this was helpful.
Thank You.
in Android you can invite friends from an app using Intent, see the following Code
final ComponentName name = new ComponentName("com.whatsapp", "com.whatsapp.ContactPicker");
Intent oShareIntent = new Intent();
oShareIntent.setComponent(name);
oShareIntent.setType("text/plain");
oShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Your Message");
startActivity(oShareIntent);
I hope this solves your problem
I'm currently building an app that has Email sending capabilities. I'm trying to send an Email with the relevant information and includes a link to the original post that is being sent. the original post is created as an HTML code segment, so I have to send the Email as an HTML. i create the Email dialog like this:
var mail = Ti.UI.createEmailDialog({
subject:'FW:'+post.desc,
html:true,
messageBody: '<br><br>view original post<br><br><b style="font-size:1.5em;font-family:Arial">'+post.desc+'</b><br><br><i>'+metaData.text.toString().replace(/\n/g,'<br>')+' </i><br><br>'+post.htmlData
});
Ti.API.debug(mail.messageBody)
mail.open();
when I ran the app on my device, I got the option of sending via "mail" or via "Gmail". when sent via "mail", all the link tabs and and were ignored and striped so the Email didn't include them. however, the "Gmail" option left everything as suppose to.
any thoughts?
the question was asked also in Titanium Q&A
Apparently, the default Email client for Android doesn't have a HTML renderer and disregards it, and the Gmail Android client won't parse certain tags like .
it seems to me like the answer will be using temporary files and attachments.
if anybody comes up with a better answer I'll be very happy.
happy X-mas | Hanukah | festivus for the rest of us