Overview
This guide shows how to conduct an SMS survey. Surveys can help businesses with market research. Using SMS for surveys lets organizations process input quickly and efficiently. You can conduct SMS surveys either by using our PHLO visual workflow builder or our APIs. Follow the instructions in one of the tabs below.- Using API
Here’s how to use Plivo APIs to create surveys using SMS text messages — sending questions and collecting answers.
Replace the auth placeholders with your authentication credentials from the Plivo console. Replace the phone number placeholders with actual phone numbers in E.164 format (for example, +12025551234). In countries other than the US and Canada you can use a sender ID for the message source. You must have a Plivo phone number to send messages to the US or Canada; you can buy a Plivo number from Phone Numbers > Buy Numbers on the Plivo console or via the Numbers API.Run the project and you should see your basic server application in action at http://localhost:5001/survey/.Set up ngrok to expose your local server to the internet.

How it works

Prerequisites
To get started, you need a Plivo account — sign up with your work email address if you don’t have one already. To receive incoming messages, you must have a Plivo phone number that supports SMS; you can rent numbers from the Numbers page of the Plivo console or by using the Numbers API. If this is your first time using Plivo APIs, follow our instructions to set up a .NET development environment.Create a .NET controller
Create a new project and navigate to the Controllers directory. Create a controller called Survey.cs and paste into it this code.Note:
We recommend that you store your credentials in the
auth_id and auth_token environment variables to avoid the possibility of accidentally committing them to source control. If you do this, you can initialize the client with no arguments and Plivo will automatically fetch the values from the environment variables. You can use the Environment.SetEnvironmentVariable method to store environment variables and Environment.GetEnvironmentVariable to fetch them when initializing the client.Create a Plivo application for the SMS survey
Associate the controller you created with Plivo by creating a Plivo application. Visiting Messaging > Applications and click Add New Application. You can also use Plivo’s Application API.Give your application a name — we called oursSMS-Survey. Enter the server URL you want to use (for example https://<yourdomain>.com/survey/survey_response/) in the Message URL field and set the method to POST. Click Create Application to save your application.
Assign a Plivo number to your application
Navigate to the Numbers page and select the phone number you want to use for this application.From the Application Type drop-down, selectXML Application.From the Plivo Application drop-down, select SMS-Survey (the name we gave the application).Click Update Number to save.