Instantly collect structured data from your users with a survey conducted over a voice call or SMS text messages. Learn how to create your own survey in the language and framework of your choice. For a step-by-step tutorial see twilio docs.
And, remember to configure Twilio webhooks in the configuration section below.
First you need to install Node.js as well as MongoDB
To run the app locally:
-
Clone this repository and
cd
into it$ git clone [email protected]:TwilioDevEd/survey-node.git $ cd survey-node
-
Install dependencies
$ npm install
-
Copy the sample configuration file and edit it to match your configuration
$ cp .env .env.local
Be sure to set
MONGO_URL
to your local mongo instance uri for example:mongodb://localhost:27017/surveys
wheresurveys
is the db name.Run
source .env.local
to export the environment variables -
Run the application
$ npm start
Alternatively you might also consider using nodemon for this. It works just like the node command but automatically restarts your application when you change any source code files.
$ npm install -g nodemon $ nodemon index
-
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.
$ npm i -g ngrok $ ngrok http 3000
Once ngrok is running, open up your browser and go to your ngrok URL. It will look something like this:
http://9a159ccf.ngrok.io
You can read this blog post for more details on how to use ngrok.
You will also need to configure Twilio to call your application when calls are received
You will need to provision at least one Twilio number with voice capabilities so the application's users can take surveys. You can buy a number using the twilio console.. Once you havea number you need to configure your number to work with your application. Open the number management page and open a number's configuration by clicking on it.
-
Check it out at http://localhost:3000
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.