Triggering a SMS Send dialogue from a Mobile Phone Website CodeUnit 01 APR 2009

SMS SendSome time ago I whipped up a quick mobile interface to Touchwork’s M4E system, essentially just a basic portal listing of the event delegates with their assigned CID numbers. However, a new request has now come in that I need to be able to trigger a pre-populated SMS send-out dialogue for any particular CID to our send-in mobile number.

So how does one then actually do this?

Well the answer lies in the use of the non-standard URI scheme sms: defined by the IETF draft available here.

The essential layout looks like this: sms:?, so for example to open a SMS dialogue sending to the mobile number 10111 and containing the text ‘Help me!’ you would have:

sms:10111?body=Help me!

(Note that for international numbers you would prefix the number with a ‘+’)

And obviously to actually use the above in your web page, you would simply have something like this in your code:

SMS Help Me!

Of course this functionality only really works with the more modern phone web browsers, so older models like my Samsung SGH-E250 simply bring up an ‘incorrectly configured URL’ error when trying to access the link. However, almost all newer phone models seem perfectly happy with this syntax, so quite handy indeed.

(Oh, and another note: To achieve a similar thing like bringing up the ‘phone this number?’ dialogue on your mobile phone, switch out the sms: URI scheme with the tel: URI scheme – sans the body= modifier of course! See, can’t say that I’m not helpful eh?)

Related link:

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.

  • Rahul

    Is there a sample of complete implementation of click-to-sms including detection of various OS/Browsers and customizing response accordingly? I’ve searched a lot but cannot find any suitable samples.

    •  Nope, there is not. Looks like you’re going to be the first to come up with one then.