Giter Club home page Giter Club logo

twiliosharp's Introduction

TwilioSharp - C# Helpers for creating TwiML

TEST CHANGE ON MASTER TwilioSharp is a set of C# Class Libraries that help you create applications that take advantage of Twilio's Awesome TwiML APIs. Licensed under the Microsoft Public License (Ms-PL).

Pre-Requisites

Example Site

Check out the Magical 8 Ball Answerizer 3000 Example Site for more detail.

Show teh Codez - Reply To A Text Message From MVC 3

using System.Web.Mvc;
using TwilioSharp.MVC3.Controllers;
using TwilioSharp.Request;

public class TextController : TwiMLController
{
    [HttpPost]
    public ActionResult New(TextRequest request)
    {
        var answer = string.Format("{0} {1}, {2}?", "Hello! How's the weather today in", request.FromCity, request.FromState);
            
        return TwiML(response => response
                                    .Sms(answer));

        // Alternatively:
        //return TwiMLBuilder
        //            .Build()
        //            .Sms(answer)
        //            .ToTwiMLResult();
    }
}

Show more Codez - Answer a Phone Call

using System.Web.Mvc;
using _8Ball.Common;
using TwilioSharp.MVC3.Controllers;
using TwilioSharp.Request;

public class CallController : TwiMLController
{
    [HttpPost]
    public ActionResult New(CallRequest request)
    {
        return TwiML(response => response
                                    .Say("Thanks for calling the All Knowing Magical 8 Ball.")
                                    .Say("Ask a Question after the Beep.")
                                    .Say("Press Pound when done.")
                                    .Record(Url.Action("Question")));
    }

    [HttpPost]
    public ActionResult Question(CallRecordRequest request)
    {
        return TwiML(response => response
                                    .Say("The Magical 8 Ball Says")
                                    .Say(Magic8BallAnswerizer3000.GetAnswer())
                                    .Pause(1)                                        
                                    .GatherWhileSaying("Press Any Key To Ask Another Question.  Or Pound to Exit.", 
                                        actionUrl: Url.Action("New"),
                                        timeoutSeconds: 3)
                                    .Say("Goodbye")
                                    .Hangup());
    }
}

twiliosharp's People

Contributors

jgable avatar jdunlop-ce avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.