Skip to content

satchkat/automated-survey-sinatra

 
 

Repository files navigation

Twilio

Automated Suvey with Twilio, Ruby and Sinatra

Build Status

Follow along with this simple tutorial to see the code necessary to implement automated surveys that integrate directly with your CRM and customer database.

Read the full tutorial here!

Local development

  1. Clone the repository and cd into it

    $ git clone [email protected]:TwilioDevEd/automated-survey-sinatra.git
    $ cd  automated-survey-sinatra
  2. Install the application dependencies

    $ bundle install
  3. Create development and test databases

    Make sure you have installed PostgreSQL. If on a Mac, I recommend Postgres.app.

    $ createdb automated_survey_sinatra
    $ createdb automated_survey_sinatra_test
  4. Make sure the tests succeed

    $ bundle exec rspec
  5. Start the development server

    $ bundle exec rakeup
  6. Check it out at http://localhost:9292

  7. Expose your application to the wider internet using ngrok. This step is important because the application won't work as expected if you run it through localhost.

$ ngrok http 9292

Once ngrok is running, open up your browser and go to your ngrok URL. It will look something like this: http://<ngrok-subdomain>.ngrok.io.

You can read this blog post for more details on how to use ngrok.

  1. Configure Twilio to call your webhooks.

You will also need to configure Twilio to call your application when calls are received on your Twilio Number. The Voice url should look something like this:

http://<ngrok-subdomain>.ngrok.io/surveys/voice

And the SMS one like this:

http://<ngrok-subdomain>/surveys/sms

Configure Voice

How to Demo?

  • Voice Survey — Call your Twilio number and follow the instructions.
  • Voice Survey — Text your Twilio number with any text and follow the instructions.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

About

Learn how to implement automated phone surveys with Twilio and Sinatra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 86.2%
  • HTML 13.3%
  • CSS 0.5%