Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Twilio and Parse: Rich Experiences in & out of Native Clients

582 views

Published on

Break out of the app store. Parse (by Facebook) is a preferred backend provider for Twilio, the premier telephony service. By combining Parse and Twilio you can create a wide variety of applications which span SMS, web, mobile apps and more.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Twilio and Parse: Rich Experiences in & out of Native Clients

  1. 1. Thomas Bouldin @inilned Twilio and Parse Rich Experiences in & out of Native Clients
  2. 2. What is an App? Think outside the 4” box Modern apps are in the cloud The cloud has no home button The cloud never sleeps The cloud is complicated Your App Here
  3. 3. What is Parse? Data Social Push AnalyticsHostingCloud Code
  4. 4. Parse is Everywhere
  5. 5. Twilio + Parse Cross platform clouds are awesome Cross-media clouds are awesomer Twilio provides reach, delivery, and events Parse provides persistence, logic, and native apps
  6. 6. SMS or App Apps have a custom experience Apps are bespoke Apps have high acquisition costs SMS is universal SMS is far reaching SMS is guaranteed
  7. 7. Four different ways SMS or App Exclusive SMS is the App Hybrid Apps require SMS for core features Parity SMS or App are portals to the same experience Segmentation Different roles have different environments
  8. 8. AnyQs: A Twilio + Parse app to handle Q&A Building a Segmented App A quick afternoon hack on Twilio + Parse Audience members ask questions via SMS Web app allows moderators to approve or reject Native app for presenter to review questions
  9. 9. Data Model Pending Class Structure State Machine RejectedAccepted Answere d Question to: string from: string prompt: string state: string
  10. 10. Cloud Code in Depth Data HostingCloud Modules Functions Background Jobs
  11. 11. Asking Questions How is babby formed ?
  12. 12. Get a Parse Sub-Domain (opt) Asking Questions Within your Parse App’s settings
  13. 13. Tell Twilio Where to Send Messages Asking Questions Within the settings of your Twilio number:
  14. 14. Set up Twilio and Express Asking Questions var twilio = require("twilio"); twilio.initialize(account SID, auth token); var Question = Parse.Object.extend("Question"); var express = require("express"); var app = express(); app.use(express.bodyParser); app.listen(); app.post("/questions", function(request, response) { // TODO: stuff... (next slide) });
  15. 15. Implementing /questions Asking Questions var question = new Question({ from: request.body.From, to: request.body.To, status: "pending", prompt: request.body.Body }); question.save().then(function() { response.send(""); }, function(error) { response.status(500); response.send(error); });
  16. 16. Moderating Questions
  17. 17. Simple Web App UI Moderating Questions
  18. 18. Get Pending Questions Moderating Questions var Question = Parse.Object.extend("Question"); var query = new Parse.Query(Question); query.equalTo("status", "pending"); query.find().then(function(results) { table.empty(); _.each(results, function(question) { addRow(question.id, question.get("prompt")); }); });
  19. 19. Modifying Questions Moderating Questions function updateQuestion(id, status) { } var row = $("#question" + id); row.children("button").attr("disabled", "disabled"); var question = new Question(); question.id = id; question.set("status", status); question.save().then(function() { row.remove(); });
  20. 20. Responding to Users Moderating Questions Parse.Cloud.beforeSave("Question", function(req, resp) { var q = request.object; var promise = Parse.Promise.as(); // already fulfilled if (q.dirty("status") && q.get("status") === "rejected") { promise = twilio.sendSMS({ From: q.get("to"), To: q.get("from"), Body: "Being off topic makes me a sad panda." }); } promise.then(function() { resp.success(); }, function(error) { resp.error(error) }); });
  21. 21. Answering Questions
  22. 22. Thomas Bouldin @inilned Concluding with a Demo AKA Q&A
  23. 23. Hack Ideas Push + SMS chatroom SMS password reset SMS alerts on data streams SMS voting + Parse Analytics

×