SMS link protocol

I needed to use a the sms: link protocol the other day and as it’s a rare bit of HTML I thought I’d record what I found.

Defined in 2008 it seems to have had sporadic support in mobile browsers over the years. The official syntax is:

<a href="sms:[PHONE-NUMBER]?body=[MESSAGE]">

The body text should be URL encoded.

Android support

Android support is as ever a mixed bag. The official syntax works fully on some phones. Others have degraded support with just opening the messaging app with the number prefilled but not the body text, or maybe just opening the app.

Let me know in the comments how your phone behaves.

Android test link (standard syntax)

 iPhone support

For iOS 8, Apple have their own special way to do things:

<a href="sms:[PHONE-NUMBER]&body=[MESSAGE]">

Notice the difference? Apple use an “&” instead of a “?” (This is the sort of silliness that Microsoft would get up to back in IE6 days…)

iOS 7 and before don’t seem to work.

 Apple test link

Windows Phone support?

I’ve got no idea… Let me know if the standard syntax in the Android test link works for you.

But how can I give my users the right link?

Yes I know. I don’t think you can feature detect your way out of this, so to give your users the right link format you’ll have to use your favourite evil browser detection method.  For desktop and unsupported devices’s you’ll probably end up hiding the link all together and/or swapping it for a manual call to action.

I’ve been building websites for 15 years and never needed this…

Me too. But there’s always an edge case lurking—my current client is a Turkish service provider that does a lot of their ecommerce via text message. Sending a text message with a product code subscribes the customer to that product. I’d guess there might be more use cases in parts of Africa and Asia where text message transactions are more common.

Should UX designers code?

Yes. But more importantly they should also test these sms: links before implementing them. I’d imaging that they’re likely to increase engagement but these types of links are pretty rare and your users may be surprised and confused to have their messaging app open.

Comments are closed