Skip to content

TwilioDevEd/airtng-csharp

Repository files navigation

Twilio

AirTNG App: Part 1 - Workflow Automation with Twilio - ASP.NET MVC

We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at github.com/twilio-labs/code-exchange/issues and we'll try to help you.

Build status

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.

Read the full tutorial here!

Local Development

  1. 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 it 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 TwilioPhoneNumber settings.

    To start using ngrok in our project you'll have execute to the following line in the command prompt.

    ngrok http 4567 -host-header="localhost:4567"
    

    Keep in mind that our endpoint is:

    http://<your-ngrok-subdomain>.ngrok.io/Reservations/Handle
    
  2. Clone this repository and cd into it.

    git clone git@github.com:TwilioDevEd/airtng-csharp.git
    
    cd airtng-csharp
    
  3. Create a new file AirTNG.Web/Local.config and update the content.

    <?xml version="1.0" encoding="utf-8"?>
    <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>
    
  4. Build the solution.

  5. Run Update-Database at Package Manager Console to execute the migrations.

  6. Run the application.

  7. 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.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • The CodeExchange repository can be found here.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.