js in sms - js.everywhere(2013)
TRANSCRIPT
JS in SMSAlexandre Morgaut & Greg McCarvellJS.everywhere(2013) - Treasure Island, SF
AgendaWhy care about SMS?
Links and Forms
HTML5
Apache Cordova
The Cloud / The Server
Why care about SMS?
Dead Zones
Many Dead Zones: subway, rural communities...
Wifi / 4G / 3G / Edge / GPRS are not always available
SMS are available almost everywhere
Foreign Countries
Data Roaming is very expensive
SMS are usually affordable
SMS are usually supported everywhere
User Friendly
Phones create notifications for SMS
Notifications are often not as detailed for mails
No mail account to configure
SMS in Links (and Forms?)
RFC 5724
URI Scheme for Global System for Mobile Communications (GSM)Short Message Service (SMS)
sms:+33123456789,+33678901234?body=Hello%20World
http://tools.ietf.org/html/rfc5724
HTML Form
<form method="GET" action="http://example.com/">
<label for="body">Write your Message</label>
<textarea name="body">Hello</textarea>
<input type="submit" value="Send">
<form>
http://example.com/?body=Hello
HTML Form
<form method="GET" action="sms:+12345678901">
<label for="body">Write your Message</label>
<textarea name="body"></textarea>
<input type="submit" value="Send">
<form>Don’t work :-(
sms:+12345678901?body=Hello
iOS
sms:+33123456789,+33678901234;body=Hello%20World
Link<a href="sms:+15552345678">Phone only</a>
<a href="sms:?body=Hello, world">Body only</a>
<a href="sms:;body=Hello, world">;body only</a>
<a href="sms:+15552345678?body=Hello World">Phone and ?body</a>
<a href="sms:+15552345678;body=Hello World">Phone and ;body</a>
<a href="sms://+15552345678">Phone only (sms://)</a>
<a href="sms://+15552345678?body=Hello, World">Phone and body (sms://)</a>
http://bradorego.com/test/sms.html
alternative schemes
“smsto:”
SMS in HTML5
Mozilla WebSMS
// There are several ways to retrieve a valid phone number var message = "Hi!";var number = "1234";
navigator.mozMobileMessage.send(number, message);
https://developer.mozilla.org/en-US/docs/WebAPI/WebSMS
“The Messaging API”
navigator.device.sendMessage( "sms:+460000000001?body=Welcome%20%to%Atlantis", null, successCB, errorCB );
navigator.device.sendMessage( "mms:+460000000001?body=Welcome%20%to%Atlantis", [image1, image2], successCB, errorCB );
http://www.w3.org/TR/messaging-api/
Device APIs W3C Working Group
“Messaging API”
navigator.messaging.sms.send( '+1234567890', 'How are you?').done( function(message) { window.console.log( 'Message with identifier ' + message.messageID + ' sent at ' + message.timestamp ); }, function(error) { window.console.error('Error: ' + error); } )
http://www.w3.org/TR/messaging/
System Application W3C Working Group
Contacts
Device APIs
Pick Contact Intent
System Application
Contact Manager API
http://www.w3.org/TR/contacts-manager-api/http://www.w3.org/TR/contacts-api/
Apache Cordova
Cordova Plugins
https://github.com/phonegap/phonegap-plugins
iOS
PhoneGap SMSComposer
Androïd
SMS inbox_sent access
SMSPlugin
SMSSendPlugin
ContactView
The Cloud / The Server
Cloud Communication
Twilio
Nexmo
Tropo
...
Cloud CommunicationTwilio
SMS, MMS, Voice
REST API
twilio.js
node.js SSJS connector
wakanda SMS connector
https://www.twilio.com
wakanda-twilio
Demo
https://github.com/AMorgaut/wakanda-twilio
Thank You!
https://github.com/amorgaut
http://www.twilio.com/
http://www.wakanda.org/
https://github.com/mccarvell