Giter Site home page Giter Site logo

ivandrofly / twilio-csharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twilio/twilio-csharp

0.0 2.0 0.0 48.92 MB

Twilio C#/.NET Helper Library for .NET 3.5+ and .NET Standard 1.4

Home Page: https://www.twilio.com/docs/libraries/csharp

License: MIT License

Makefile 0.01% PowerShell 0.05% C# 99.94%

twilio-csharp's Introduction

Twilio REST API and TwiML Libraries for .NET

Twilio provides a simple HTTP-based API for sending and receiving phone calls and text messages. Learn more at http://www.twilio.com

Adding Twilio libraries to your .NET project

The best and easiest way to add the Twilio libraries to your .NET project is to use the NuGet package manager.

With Visual Studio IDE

From within Visual Studio, you can use the NuGet GUI to search for and install the Twilio NuGet package. Or, as a shortcut, simply type the following command into the Package Manager Console:

Install-Package Twilio

With .NET Core Command Line Tools

If you are building with the .NET Core command line tools, then you can run the following command from within your project directory:

dotnet add package Twilio

Sample Usage

The examples below show how to have your application initiate and outbound phone call and send an SMS message using the Twilio .NET helper library:

TwilioClient.Init("ACCOUNT_SID", "AUTH_TOKEN");

var call = CallResource.Create(
    new PhoneNumber("+11234567890"), 
    from: new PhoneNumber("+10987654321"), 
    url: new Uri("https://my.twiml.here")
);
Console.WriteLine(call.Sid);

var message = MessageResource.Create(
    new PhoneNumber("+11234567890"), 
    from: new PhoneNumber("+10987654321"), 
    body: "Hello World!"
);
Console.WriteLine(message.Sid);

TwiML Generation

var gather = new Gather(numDigits: 1, action: "hello-monkey-handle-key.cshtml", method: "POST")
    .Say("To speak to a real monkey, press 1. Press 2 to record your own monkey howl. Press any other key to start over.");

var response = new VoiceResponse()
    .Say("Hello Monkey")
    .Play("http://demo.twilio.com/hellomonkey/monkey.mp3")
    .Gather(gather);
Console.WriteLine(response);
    
/*
<?xml version="1.0" encoding="utf-8"?>
<Response>
  <Say>Hello Monkey</Say>
  <Play>http://demo.twilio.com/hellomonkey/monkey.mp3</Play>
  <Gather numDigits="1" action="hello-monkey-handle-key.cshtml" method="POST">
    <Say>To speak to a real monkey, press 1. Press 2 to record your own monkey howl. Press any other key to start over.</Say>
  </Gather>
</Response>
*/

Migrating from earlier versions

See the migration guide here. Also, if you were using the Twilio.Mvc package, that has been replaced by the Twilio.AspNet.Mvc package which is compatible with this version of the library.

Alpha Version

The alpha version of the Twilio .NET library is available on nuget. This version is a superset of the mainline version that includes all of the Twilio Products that are currently in beta. To install the alpha version from the NuGet Package manager console, add the -prerelease flag to the Install-Package command:

Install-Package Twilio -prerelease

Getting help

If you need help installing or using the library, please contact Twilio Support at [email protected] first. Twilio's Support staff are well-versed in all of the Twilio Helper Libraries, and usually reply within 24 hours.

If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!

twilio-csharp's People

Contributors

jingming avatar skimbrel avatar alexpayment avatar johnsheehan avatar jwitz10 avatar mplacona avatar dprothero avatar ragil avatar joelmartinez avatar carlosdp avatar wanjunsli avatar matthewsteeples avatar acamino avatar alden-quimby-zocdoc avatar akjordan avatar barranger avatar brettgerry avatar dbrink-onebridge avatar peranborkett avatar senthgit avatar craigomatic avatar

Watchers

James Cloos avatar Ivandro Jao 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.