Follow along with this simple tutorial to see the code necessary to implement automated surveys that integrate directly with your CRM and customer database.
-
Clone the repository and
cd
into it$ git clone [email protected]:TwilioDevEd/automated-survey-sinatra.git $ cd automated-survey-sinatra
-
Install the application dependencies
$ bundle install
-
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
-
Make sure the tests succeed
$ bundle exec rspec
-
Start the development server
$ bundle exec rakeup
-
Check it out at
http://localhost:9292
-
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.
- 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
- Voice Survey — Call your Twilio number and follow the instructions.
- Voice Survey — Text your Twilio number with any text and follow the instructions.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.