Learn how to automate your workflow using Twilio's REST API and Twilio SMS. This example app is a vacation rental site, where the host can confirm a reservation via SMS.
-
You will need to configure Twilio to send requests to your application when SMS are received.
You will need to provision at least one Twilio number with sms capabilities so the application's users can make property reservations. You can buy a number right here. Once you have a 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.
Remember that the number where you change the SMS webhook must be the same one you set on the
TwilioPhoneNumbersetting.To start using
ngrokin our project you'll have execute to the following line in the command prompt:ngrok http 4567 -host-header="localhost:4567"Bear in mind that our endpoint is:
http://<your-ngrok-subdomain>.ngrok.io/Reservations/Handle -
Clone this repository and
cdinto its directory:git clone [email protected]:TwilioDevEd/airtng-csharp.git cd airtng-csharp -
Create a new file
AirTNG.Web/Local.configand update the content with:<appSettings> <add key="TwilioAccountSid" value="Your Twilio Account SID" /> <add key="TwilioAuthToken" value="Your Twilio Auth Token" /> <add key="TwilioPhoneNumber" value="Your Twilio Phone Number" /> </appSettings> -
Build the solution.
-
Run
Update-Databaseat Package Manager Console to execute the migrations. -
Run the application.
-
Check it out at http://localhost:4567
That's it!
To let our Twilio Phone number use the callback endpoint we exposed, our development server will need to be publicly accessible. We recommend using ngrok to solve this problem.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.
