Augmenting Web Services with SMS and XMPP

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    XMPP : Extensible Messaging and Presence Protocol

    3 Favorites

    Augmenting Web Services with SMS and XMPP - Presentation Transcript

    1. Augmenting Web Services with SMS and XMPP
      • Adding Channels such as SMS and XMPP to traditional HTTP services
    2. About Me
      • Sam Keen [email_address] , @samkeen
      • Originally a Java (J2EE) developer Escaped that for PHP ~2003
      • Founded and have been running PDXPHP for about 4 years
      • currently employed at finedesigngroup.com/
    3. Talk Summary
      • Advantages of adding these channels
      • Overview of SMS and XMPP
      • Explain Extapi (my take on implementing these channels)
      • Example Service: Trimet TransitTracker ®
      • Teaching humans to speak Machine: HAMDL
      • Future
    4. Motivation Laziness
    5. Why (users)
      • The mobile generation is growing accustomed to passive aggressive connectivity
      • Mobile users are loosely engaged with services
      • For many services, users want information and do not want ‘experience’ to get in the way
    6. Why (devices)
      • More and more, Web sites services are accessed through mobile devices
      • Device capability
        • A subset of devices have data access ability
        • Of those devices, a small percentage provide an acceptable degree of usability
    7. Why SMS
      • Low Attention Requirement
      • All modern phone support it
      Even this phone has SMS ability
    8. SMS Downside
    9. SMS Downside
      • Some might say: “SMS is controlled by Evil Empires”
      • $$$ to implement on your own
      • Very limited capability
      SMS
    10. Why XMPP
      • Open Standard
      • Its all about the X (extendable)
        • Presence, multi-user chat, SOAP over XMPP, Jingle (voice, video, file) , oauth over XMPP, ...
      • http://xmpp.org/extensions/
      • Ease of implementation
    11. Why XMPP It makes SMS look like:
    12. Extapi
      • Centralized Service and Channel Adaption Manager
      • Currently Implemented as a PHP LAMP stack
      • Enables you to extend the number of channels available to a web service
      • Goal is to enable new services and channels by way of configuration (little or no code)
    13. What Extapi Needs to do
      • Map given request params to a common set of values for a given channel
      • parse/authenticate request
      • make the request to the target web service
      • parse the response from the web service
      • sent the response back through the channel to the client
    14. Architecture Goal Web Service X HTTP Users
    15. Architecture Goal Web Service X XMPP SMS Channel N HTTP Users
    16. Architecture Channels SMS XMPP Services Trimet Twitter Service X Channel X Extapi App Server Clients HTTP
    17. Architecture Channels SMS XMPP Services Trimet Twitter Service X Channel X Clients HTTP
    18. Extapi Structure MVC Container Aabot App Static Vendor Extapi Built in the style of a Vendor plugin. Currently within the Aabot MVC container. Can also be adapted for containers such as CakePHP Channels Services
    19. Channels
      • Purpose is to take and existing protocol (XMPP, SMS), and convert to HTTP. Then forward the message to the Extapi server
      • So after querying a http web service Extapi can then send replies back through the channel via HTTP, or short circuit directly to the originator if it can speak the originating protocol.
    20. Implementing an SMS Channel
        • Shortcode Shares: Multiple users share a single shortcode managed by a Shortcode share company
      • Shortcode Shares are the cheapest, bi-directional, most reliable way to get started.
    21. SMS Shortcode SharesFREE! There are concessions to be made for all the “Freeness”
      • SMS SS will typically append ~20 char teaser ads to client bound messages
      SMS Shortcode SharesFREE! There are concessions to be made for all the “Freeness”
      • SMS SS will typically append ~20 char teaser ads to client bound messages
      • Your app context lives under a keyword on the provider’s shortcode ex: you text “ myapp my message ” to shortcode 123456 rather than just texting “ my message ” to shortcode 123456
      SMS Shortcode SharesFREE! There are concessions to be made for all the “Freeness”
    22. SMS Shortcode Shares
      • They blackbox the entire telco infrastructure
      • Provide a familiar HTTP API interface to the developer
      • They manage user registration and opt out
      There are also benefits
    23. Shortcode Share Architecture Extapi (or any web app) mobile carrier Users Short Code Share HTTP HTTP
    24. Shortcode Shares
      • Textmarks: Mature, feature rich
      • Zeep: New kid on the block
      • Dotgo: Different Beast
      A Few Options
    25. Dotgo <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?><cmrl xmlns:dotgo=&quot; http://dotgo.com/cmrl/1.0 &quot;> <match pattern=&quot;*&quot;> <engine href=&quot; http://example.com/servic e.php &quot;/> OR <message> <content>Hello world!</content> </message> </match></cmrl>
    26. Channel: XMPP
      • Many Server Choices: http://xmpp.org/software/servers.shtml
      • I chose the Hometown crew: Openfire
        • very easy to setup
        • easy to extend (if you know a little Java)
        • Well documented and supported
        • Lots of example Plugin code
    27. Example XMPP Channel Architecture Users Extapi XMPP Server (Openfire) X2Http Plugin HTTP XMPP
    28. X2Http Openfire plugin
    29. Example: TransitTracker ® Currently offers web access, WAP, and IVR These all require the user to be highly engaged with the service
    30. SMS & XMPP added to TransitTracker ®
      • Less attention required, input stop id and then your device has all sorts of ways to alert you with the reply
      • SMS has wide reach, XMPP has decent reach + extended capability
    31. Trimet over SMS
    32. Trimet over XMPP
    33. Yes It Is Alpha code
    34. Review: What Extapi Needs to do
      • Map given request params to a common set of values for a given channel
      • Parse/Authenticate request
      • make the request to the target web service
      • parse the response from the web service
      • sent the response back through the channel to the client
    35. Extapi: Base Class for a channel Extapi Channels class Extapi_Channel_Base /** * @return boolean */ public function have_required_request_params() /** * @return boolean */public abstract function authenticate_request();
    36. Extapi: Base Class for a Service Extapi Service class Extapi_Service_Base public abstract function parse_request_statement();public abstract function act_on_request_statement();public abstract function gather_feedback();
      • private function sms_receiver() {
      • $this ->use_layout = false ;
      • $requesting_channel = $this ->next_request_segment_value();
      • header( 'Content-type: text/plain' , true );
      • $sms_channel = Util_VendorFactory::get_instance( 'extapi/channel/'
        • . $requesting_channel );
      • if ( $sms_channel && $sms_channel ->have_required_request_params()
        • && $sms_channel ->authenticate_request()) {
      • ENV::load_vendor_file( 'Extapi/Service/Tmet' );
      • $tmet_service = new Extapi_Service_Tmet( $sms_channel );
      • $tmet_service ->parse_request_statement();
      • $tmet_service ->act_on_request_statement();
      • if ( $tmet_service ->has_feedback()) {
      • $arrivals = $tmet_service ->gather_feedback();
      • $this ->payload->arrivals = array_get_else( $arrivals , 'arrivals' );
      • $this ->payload->transit_stop = array_get_else( $arrivals , 'transit_stop' );
      • $this ->payload->query_time = array_get_else( $arrivals , 'query_time' );
      • } else {
      • $this ->viewless();
      • }
      • } else {
      • if (! $sms_channel ) {
      • ENV:: $log ->error(__METHOD__. ' Util_VendorFactory::get_instance ...
        • } else {
      • ENV:: $log ->notice(__METHOD__. ' Required components were not ...
        • }
      • $this ->viewless();
      • }
      • }
      • private function sms_receiver() {
      • $this->use_layout = false;
      • $requesting_channel = $this ->next_request_segment_value();
      • header('Content-type: text/plain',true);
      • $sms_channel = Util_VendorFactory::get_instance( 'extapi/channel/'
        • . $requesting_channel );
      • if ($sms_channel && $sms_channel->have_required_request_params()
        • && $sms_channel->authenticate_request()) {
      • ENV::load_vendor_file('Extapi/Service/Tmet');
      • $tmet_service = new Extapi_Service_Tmet($sms_channel);
      • $tmet_service->parse_request_statement();
      • $tmet_service->act_on_request_statement();
      • if ($tmet_service->has_feedback()) {
      • $arrivals = $tmet_service->gather_feedback();
      • $this->payload->arrivals = array_get_else($arrivals,'arrivals');
      • $this->payload->transit_stop = array_get_else($arrivals,'transit_stop');
      • $this->payload->query_time = array_get_else($arrivals,'query_time');
      • } else {
      • $this->viewless();
      • }
      • } else {
      • if (! $sms_channel) {
      • ENV::$log->error(__METHOD__.' Util_VendorFactory::get_instance ...
        • } else {
      • ENV::$log->notice(__METHOD__.' Required components were not ...
        • }
      • $this->viewless();
      • }
      • }
      • private function sms_receiver() {
      • $this->use_layout = false;
      • $requesting_channel = $this->next_request_segment_value();
      • header('Content-type: text/plain',true);
      • $sms_channel = Util_VendorFactory::get_instance('extapi/channel/'
        • .$requesting_channel);
      • if ( $sms_channel && $sms_channel ->have_required_request_params()
        • && $sms_channel ->authenticate_request()) {
      • ENV::load_vendor_file('Extapi/Service/Tmet');
      • $tmet_service = new Extapi_Service_Tmet($sms_channel);
      • $tmet_service->parse_request_statement();
      • $tmet_service->act_on_request_statement();
      • if ($tmet_service->has_feedback()) {
      • $arrivals = $tmet_service->gather_feedback();
      • $this->payload->arrivals = array_get_else($arrivals,'arrivals');
      • $this->payload->transit_stop = array_get_else($arrivals,'transit_stop');
      • $this->payload->query_time = array_get_else($arrivals,'query_time');
      • } else {
      • $this->viewless();
      • }
      • } else {
      • if (! $sms_channel) {
      • ENV::$log->error(__METHOD__.' Util_VendorFactory::get_instance ...
        • } else {
      • ENV::$log->notice(__METHOD__.' Required components were not ...
        • }
      • $this->viewless();
      • }
      • }
      • private function sms_receiver() {
      • $this->use_layout = false;
      • $requesting_channel = $this->next_request_segment_value();
      • header('Content-type: text/plain',true);
      • $sms_channel = Util_VendorFactory::get_instance('extapi/channel/'
        • .$requesting_channel);
      • if ($sms_channel && $sms_channel->have_required_request_params()
        • && $sms_channel->authenticate_request()) {
      • ENV::load_vendor_file( 'Extapi/Service/Tmet' );
      • $tmet_service = new Extapi_Service_Tmet( $sms_channel );
      • $tmet_service ->parse_request_statement();
      • $tmet_service ->act_on_request_statement();
      • if ( $tmet_service ->has_feedback()) {
      • $arrivals = $tmet_service ->gather_feedback();
      • $this ->payload->arrivals = array_get_else( $arrivals , 'arrivals' );
      • $this ->payload->transit_stop = array_get_else( $arrivals , 'transit_stop' );
      • $this ->payload->query_time = array_get_else( $arrivals , 'query_time' );
      • } else {
      • $this ->viewless();
      • }
      • } else {
      • if (! $sms_channel) {
      • ENV::$log->error(__METHOD__.' Util_VendorFactory::get_instance ...
        • } else {
      • ENV::$log->notice(__METHOD__.' Required components were not ...
        • }
      • $this->viewless();
      • }
      • }
      • private function xmpp_receiver() {
      • $this ->use_layout = false ;
      • $requesting_channel = $this ->next_request_segment_value();
      • $xmpp_channel = Util_VendorFactory::get_instance( 'extapi/channel/'
        • . $requesting_channel );
      • if ( $xmpp_channel && $xmpp_channel ->have_required_request_params()
        • && $xmpp_channel ->authenticate_request()) {
      • ENV::load_vendor_file( 'Extapi/Service/Tmet' );
      • $tmet_service = new Extapi_Service_Tmet( $xmpp_channel );
      • $tmet_service ->parse_request_statement();
      • $tmet_service ->act_on_request_statement();
      • if ( $tmet_service ->has_feedback()) {
      • $arrivals = $tmet_service ->gather_feedback();
      • $this ->payload->arrivals = $arrivals ;
      • } else {
      • $this ->viewless();
      • }
      • } else {
      • if (! $xmpp_channel ) {
      • ENV:: $log ->error(__METHOD__. ' Util_VendorFactory::get_instance failed for
            • [extapi/channel/' . $requesting_channel . ']' );
      • } else {
      • ENV:: $log ->notice(__METHOD__. ' Required components were not found
            • and/or authentcation failed for this request' );
      • }
      • $this ->viewless();
      • }
      • }
      • private function xmpp_receiver() {
      • $this->use_layout = false;
      • $requesting_channel = $this ->next_request_segment_value();
      • $xmpp_channel = Util_VendorFactory::get_instance( 'extapi/channel/'
        • . $requesting_channel );
      • if ($xmpp_channel && $xmpp_channel->have_required_request_params()
        • && $xmpp_channel->authenticate_request()) {
      • ENV::load_vendor_file('Extapi/Service/Tmet');
      • $tmet_service = new Extapi_Service_Tmet($xmpp_channel);
      • $tmet_service->parse_request_statement();
      • $tmet_service->act_on_request_statement();
      • if ($tmet_service->has_feedback()) {
      • $arrivals = $tmet_service->gather_feedback();
      • $this->payload->arrivals = $arrivals;
      • } else {
      • $this->viewless();
      • }
      • } else {
      • if (! $xmpp_channel) {
      • ENV::$log->error(__METHOD__.' Util_VendorFactory::get_instance failed for
            • [extapi/channel/'.$requesting_channel.']');
      • } else {
      • ENV::$log->notice(__METHOD__.' Required components were not found
            • and/or authentcation failed for this request');
      • }
      • $this->viewless();
      • }
      • }
      • private function xmpp_receiver() {
      • $this->use_layout = false;
      • $requesting_channel = $this->next_request_segment_value();
      • $xmpp_channel = Util_VendorFactory::get_instance('extapi/channel/'
        • .$requesting_channel);
      • if ( $xmpp_channel && $xmpp_channel ->have_required_request_params()
        • && $xmpp_channel ->authenticate_request()) {
      • ENV::load_vendor_file('Extapi/Service/Tmet');
      • $tmet_service = new Extapi_Service_Tmet($xmpp_channel);
      • $tmet_service->parse_request_statement();
      • $tmet_service->act_on_request_statement();
      • if ($tmet_service->has_feedback()) {
      • $arrivals = $tmet_service->gather_feedback();
      • $this->payload->arrivals = $arrivals;
      • } else {
      • $this->viewless();
      • }
      • } else {
      • if (! $xmpp_channel) {
      • ENV::$log->error(__METHOD__.' Util_VendorFactory::get_instance failed for
            • [extapi/channel/'.$requesting_channel.']');
      • } else {
      • ENV::$log->notice(__METHOD__.' Required components were not found
            • and/or authentcation failed for this request');
      • }
      • $this->viewless();
      • }
      • }
      • private function xmpp_receiver() {
      • $this->use_layout = false;
      • $requesting_channel = $this->next_request_segment_value();
      • $xmpp_channel = Util_VendorFactory::get_instance('extapi/channel/'
        • .$requesting_channel);
      • if ($xmpp_channel && $xmpp_channel->have_required_request_params()
        • && $xmpp_channel->authenticate_request()) {
      • ENV::load_vendor_file( 'Extapi/Service/Tmet' );
      • $tmet_service = new Extapi_Service_Tmet( $xmpp_channel );
      • $tmet_service ->parse_request_statement();
      • $tmet_service ->act_on_request_statement();
      • if ( $tmet_service ->has_feedback()) {
      • $arrivals = $tmet_service ->gather_feedback();
      • $this ->payload->arrivals = $arrivals ;
      • } else {
      • $this ->viewless();
      • }
      • } else {
      • if (! $xmpp_channel) {
      • ENV::$log->error(__METHOD__.' Util_VendorFactory::get_instance failed for
            • [extapi/channel/'.$requesting_channel.']');
      • } else {
      • ENV::$log->notice(__METHOD__.' Required components were not found
            • and/or authentcation failed for this request');
      • }
      • $this->viewless();
      • }
      • }
    37. Talking to Machines
      • Examples so far have been very limited, our statement to the Machine is just a number
      • How do we have ‘dialogue’ with machines?
      • Invest millions in Natural Language Processing? OR have an intermediary language to bridge the gap between Natural Language (English, French, Spanish, etc) and Programming languages.
    38. Bridge Language
      • A bridge language helps the machine by adding ‘token markers’ and limiting the vocabulary set
      • Twitter is an example: @samkeen is at #phpworks
      • Many other examples, some cataloged at http://microformats.org/wiki/picoformats
    39. HAMDL
      • Bridge language meant to be an open standard to help unify some of these ‘pico formats’
      • Major goal is accessibility : device and human
        • Ease of use for limited capability devices
        • Ease of use for limited capability humans
      • http://hamdl.pbwiki.com/
    40. Future
      • Channels
        • OpenCV visual channel
        • barcode channel
        • More NLP for HAMDL
    41. Sources
      • XMPP: http://xmpp.org /
      • XMPP Servers: http://xmpp.org/software/servers.shtml
      • Openfire: http://www.igniterealtime.org/projects/openfire/index.jsp
      • Extapi: http://code.google.com/p/extapi
      • HAMDL: http://hamdl.pbwiki.com /

    + Sam KeenSam Keen, 2 years ago

    custom

    1879 views, 3 favs, 0 embeds more stats

    Adding Channels such as SMS and XMPP to traditional more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1879
      • 1879 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 59
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags