Create a gist now

Instantly share code, notes, and snippets.

Embed
Send SMS with Twilio 5.x helper library with manually created TwilioRestClient
using System;
using Twilio.Clients;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
namespace ConsoleApplication32
{
class Program
{
static void Main(string[] args)
{
// Your Account SID from twilio.com/console
var accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
// Your Auth Token from twilio.com/console
var authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
var client = new TwilioRestClient(accountSid, authToken);
var message = MessageResource.Create(
to: new PhoneNumber("+15558675309"),
from: new PhoneNumber("+15017250604"),
body: "Hello from C#",
client: client);
Console.WriteLine(message.Sid);
Console.Write("Press any key to continue.");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment