Development

The processing of flavor
Twilio And Shiny Integrated

Edit February 13, 2015: View our updated post on using Twilio with R here

~~Edit: Since this blog post, we have created an R package for Linux that works with S3 buckets. We have updated this post to work with it.~~

As Shiny Server gets more and more production ready, developers are adding new features that typically aren't easy to build in—examples include automated phone notifications through Twilio. Twilio allows your application to send phone calls and text messages to users of your application when a triggering event occurs. For example, we use it to call our clients of potential flaws, taints, and contamination's in their products in real time.

This tutorial will teach you to integrate Twilio with a basic Shiny application which places a sample call to your users. This tutorial will leave you with a working application which you can build into your own needs. This tutorial will require the following:

  • R
  • Shiny
  • some knowledge of servers including FTP and APIs

This tutorial focuses on Shiny Server, but most of the code could easily be converted to other R based web frameworks or batch scripts. The code for the Shiny Version is located on GitHub.

Our current situation provides is we have a button and field in shiny through which our users can enter their phone number and hit the button to test. Here's how we did it in R. The first thing we needed was a simple input and button in our Ui.R file which was the following code:

 1 div(class="message_test",
 2     div(class="center",
 3         textInput("phone_number", label="", value="")),
 4     div(class="center",
 5         HTML("<div class='center'>
 6             <button id='send_test_call' class='action-button btn btn-default '>
 7             Send test Call</button>
 8             </div>")
 9         )
10     )
Read more

Looking for a specific post?