I am trying to create a link in an email that will open a mobile device's default texting app if pushed. Here is what I have so far:
a href="sms:;?&body=This%20is%20the%20body%20message."
I have tested it and it seems to work on iOS devices as well as some Android devices. However, on a Google Pixel 3, it opens the default messaging app but shows an error which reads Could not start conversation.
How can I change my code to successfully open a conversation with a blank recipient?
After hours of trial and error, I was able to prefill the Pixel (3XL), iOS (simulated in Xcode), and macOS Messages using the following structure:
Pixel: sms://+1${PHONE}/?body=${encodedString}
iOS: sms://+1${PHONE}/&body=${encodedString}
Give this a try from a link, I think you need a number and replace ; with ?
Send SMS
For non iOS you want to use (For your Pixel Example)
sms:phone_number?body=The_Message
For iOS you want to use
sms:phone_number;body=The_Message
We are currently testing with a Samsung device.
As shown in the attached photo below, DynamickLink's address is not recognized.
Is there a workaround?
This seems out of your control, but it looks like the SMS app does not recognise .link as a domain and therefor stops at .li.
Use another, more common domain and it should work everywhere. Alternatively use another link shortening service like https://goo.gl or something.
I'm making a pair of website-based apps for both Android and iOS interfaces, and I'm struggling with a part of it. Perhaps you guys could help me out!
I'm using Android Studio and Xcode, and launching the website through WebKit and WK WebView respectively. It's super simple, just an app which calls a website into it directly. No external navigation, nothing but a full-page website. And this part is working great!
But I do have one problem! I don't want my users to get consistently logged out if they close the app, or after a few hours of not using it. I'd like it to stay logged in for them, or to automatically log-in when they use it.
The maker of the website has given me a way to do this through the URL.
Basically, my URL currently is set up like "https://URL.com/x/y/z" and it goes to the website, and that is great, but I need to set it up to be "https://url.com/x/y/z/[insert user's IMEI or UDID here]". That unique ID from their Android device will keep them logged in. I've tested it using my own device with my own IMEI and it works great, but obviously using one specific identifier for everyone will not work. I just need it to call the specific user's IMEI or UDID into the URL, to complete it.
How should I go about this?
I am assuming that you are talking about an Android app that visualizes a website in an activity. On Android, you can retrieve the device's IMEI OR MEID string by calling:
android.telephony.TelephonyManager.getDeviceId().
But be warned, this requires that you add a permission to your manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
You should inform your users why you are requesting this permission.
For iOS/Xcode, you can get the device UUID via UIDevice:
// Swift 4
let uuid = UIDevice.current.identifierForVendor!.uuidString
If you are targeting iOS 11 or newer, Apple introduced Device Check to get a device specific token. I personally haven't used it, but it sounds like it's use case is similar to what you're looking for.
Update:
From your comment, here is how'd you include it in the url string.
let urlString = "url.com/x/y/z/" + uuid
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