Skip to content

graham-saunders/twilio-aspnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio.AspNet

Build status

ASP.NET tools for use with v5.x of the Twilio helper library for use with:

  • ASP.NET MVC 3-5 on the .NET Framework
  • ASP.NET Core 1-2 on .NET Core

You only need this library if you wish to respond to Twilio webhooks for voice calls and SMS messages. If you only need to use the Twilio REST API's, then you only need the Twilio helper library.

Twilio.AspNet.Mvc

Requirements

Requires .NET 4.5.1 or later with ASP.NET MVC 3-5.

Installation

Install-Package Twilio.AspNet.Mvc

Twilio.AspNet.Core

Requirements

Requires .NET Core 1.0 or later with ASP.NET Core 1.0 or later.

Installation

Install-Package Twilio.AspNet.Core

Code Samples for Either Library

Incoming SMS

using Twilio.AspNet.Common;
using Twilio.AspNet.Mvc; // or .Core
using Twilio.TwiML;

namespace WebApplication23.Controllers
{
    public class SmsController : TwilioController
    {
        // GET: Sms
        public TwiMLResult Index(SmsRequest request)
        {
            var response = new MessagingResponse();
            response.Message(
                $"Hey there {request.From}! " +
                "How 'bout those Seahawks?"
            );
            return TwiML(response);
        }
    }
}

Incoming Voice Call

using Twilio.AspNet.Common;
using Twilio.AspNet.Mvc; // or .Core
using Twilio.TwiML;

namespace WebApplication23.Controllers
{
    public class VoiceController : TwilioController
    {
        // GET: Voice
        public TwiMLResult Index(VoiceRequest request)
        {
            var response = new VoiceResponse();
            response.Say($"Welcome. Are you from {request.FromCity}?");
            return TwiML(response);
        }
    }
}

About

Twilio tools for ASP.NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 86.1%
  • PowerShell 13.9%