Rescue Me!
Make your escape with Twilio
Robert Horvick
@bubbafat
Custom .NET Development and Training
How to get out of
meetings
Escape
Freedom!
How would
we do that?
SMS
MMS
Voice
Enough Talk
Let’s build something
public class EchoController : TwilioController
{
[HttpPost]
public ActionResult Index(SmsRequest message)
{
TwilioResponse...
public class EchoController : TwilioController
{
[HttpPost]
public ActionResult Index(SmsRequest message)
{
TwilioResponse...
public class EchoController : TwilioController
{
[HttpPost]
public ActionResult Index(SmsRequest message)
{
TwilioResponse...
public class EchoController : TwilioController
{
[HttpPost]
public ActionResult Index(SmsRequest message)
{
TwilioResponse...
public class EchoController : TwilioController
{
[HttpPost]
public ActionResult Index(SmsRequest message)
{
TwilioResponse...
public class EchoController : TwilioController
{
[HttpPost]
public ActionResult Index(SmsRequest message)
{
TwilioResponse...
TwiML?
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Message>The SMS Message!</Message>
</Response>
MVC
SMS POST
TwiMLSMS
MVC
SMS POST
TwiMLSMS
Try It!
Security?
Things We Know…
URL Path and Query String
POST Parameters
HTTP Headers
Things We Hope…
The request is from Twilio
X-Twilio-Signature
X-Twilio-Signature
URL Path and Query String
POST Parameters
HMAC-SHA1 (Auth Token)
Shhhh…
Your authentication token is
a secret.
ValidateRequest
Twilio Authentication: The Easy Way
Why are we
building APIs using
MVC?
Web API
Nope!
• MVC Only
• Derives from Controller
• ValidateRequest uses MVC Filters
Twilio.WebApi
• Nuget Package
• Derives from ApiController
• ValidateRequest works
• MVC Code-Compatible
Web API
It’s easier, right?
Sending Messages
It’s even easier
Rescue Me!
Web Role
Web Role
Azure Service Bus Queue
Worker Role
Web Role
Azure Service Bus Queue
Worker Role
Rescue Me!
Web, Worker and Stuff
919-261-3536
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Rescue Me - Getting out of Meetings Using Twilio
Upcoming SlideShare
Loading in …5
×

Rescue Me - Getting out of Meetings Using Twilio

409 views
284 views

Published on

Twilio is a cloud service for sending and receiving SMS, MMS and voice calls within your application.

In this presentation I walked through building a simple service that would help you get out of meetings by sending a "rescue" text message at the right time.

Published in: Software, Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
409
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 1) Create Empty ASP.NET Project2) Add Twilio nuget reference3) Add SMS Controller [HttpPost] public ActionResult Index(SmsRequest request) {TwilioResponse response = new TwilioResponse();response.Message(request.Body); return TwiML(response); }4) Publish with downloaded publishing profile (DELETE ALL EXISTING FILES!)5) Use postman to demonstrate the POST queryhttp://trinugecho1.azurewebsites.net/sms/?Body=The SMS Message!6) Talk about the XML responseAllocate a new number in Twilio and link to the site
  • [ValidateRequest(Twilio.Config.AuthKey)] PublishShow it failing it PostManShow it working via SMS
  • Go back to VS and create a Web API interface
  • Add a new Web API ProjectWeb API controllerIHttpActionResult
  • Add new C# console projectAdd ref to TwilioAdd ref to domainTwilioRestClient client = new TwilioRestClient(Twilio.Config.AccountSid, Twilio.Config.AuthKey); client.SendSmsMessage(Twilio.Config.From, &quot;+19195259123&quot;, &quot;Don&apos;t forget to get the milk!&quot;);
  • Controllers\SmsController.csExplain how CommandProcessor just figures out which command to executeShow Help.cs (easiest command)Show In.csTalk about the Service Bus queue versus Azure queuesShow OutboundMessageQueue.csShow WorkerRole.cs
  • Rescue Me - Getting out of Meetings Using Twilio

    1. 1. Rescue Me! Make your escape with Twilio
    2. 2. Robert Horvick
    3. 3. @bubbafat
    4. 4. Custom .NET Development and Training
    5. 5. How to get out of meetings
    6. 6. Escape
    7. 7. Freedom!
    8. 8. How would we do that?
    9. 9. SMS MMS Voice
    10. 10. Enough Talk Let’s build something
    11. 11. public class EchoController : TwilioController { [HttpPost] public ActionResult Index(SmsRequest message) { TwilioResponse response = new TwilioResponse(); response.Message(message.Body); return TwiML(response); } }
    12. 12. public class EchoController : TwilioController { [HttpPost] public ActionResult Index(SmsRequest message) { TwilioResponse response = new TwilioResponse(); response.Message(message.Body); return TwiML(response); } }
    13. 13. public class EchoController : TwilioController { [HttpPost] public ActionResult Index(SmsRequest message) { TwilioResponse response = new TwilioResponse(); response.Message(message.Body); return TwiML(response); } }
    14. 14. public class EchoController : TwilioController { [HttpPost] public ActionResult Index(SmsRequest message) { TwilioResponse response = new TwilioResponse(); response.Message(message.Body); return TwiML(response); } }
    15. 15. public class EchoController : TwilioController { [HttpPost] public ActionResult Index(SmsRequest message) { TwilioResponse response = new TwilioResponse(); response.Message(message.Body); return TwiML(response); } }
    16. 16. public class EchoController : TwilioController { [HttpPost] public ActionResult Index(SmsRequest message) { TwilioResponse response = new TwilioResponse(); response.Message(message.Body); return TwiML(response); } }
    17. 17. TwiML?
    18. 18. <?xml version="1.0" encoding="utf-8"?> <Response> <Message>The SMS Message!</Message> </Response>
    19. 19. MVC SMS POST TwiMLSMS
    20. 20. MVC SMS POST TwiMLSMS
    21. 21. Try It!
    22. 22. Security?
    23. 23. Things We Know… URL Path and Query String POST Parameters HTTP Headers
    24. 24. Things We Hope… The request is from Twilio
    25. 25. X-Twilio-Signature
    26. 26. X-Twilio-Signature URL Path and Query String POST Parameters HMAC-SHA1 (Auth Token)
    27. 27. Shhhh… Your authentication token is a secret.
    28. 28. ValidateRequest Twilio Authentication: The Easy Way
    29. 29. Why are we building APIs using MVC?
    30. 30. Web API
    31. 31. Nope! • MVC Only • Derives from Controller • ValidateRequest uses MVC Filters
    32. 32. Twilio.WebApi • Nuget Package • Derives from ApiController • ValidateRequest works • MVC Code-Compatible
    33. 33. Web API It’s easier, right?
    34. 34. Sending Messages It’s even easier
    35. 35. Rescue Me!
    36. 36. Web Role
    37. 37. Web Role Azure Service Bus Queue Worker Role
    38. 38. Web Role Azure Service Bus Queue Worker Role
    39. 39. Rescue Me! Web, Worker and Stuff
    40. 40. 919-261-3536

    ×