Skip to content

Instantly share code, notes, and snippets.

@johnsheehan
Created August 25, 2011 19:32
Show Gist options
  • Save johnsheehan/1171603 to your computer and use it in GitHub Desktop.
Save johnsheehan/1171603 to your computer and use it in GitHub Desktop.
Twilio .NET library from PowerShell example
// using Twilio;
// var twilio = new TwilioRestClient("accountSid", "authToken");
// var msg = twilio.SendSmsMessage("+15551112222", "+15553334444", "Can you believe it's this easy to send an SMS?!");
[System.Reflection.Assembly]::LoadFile("Twilio.Api.dll") | out-null
$twilio = new-object Twilio.TwilioRestClient("accountSid", "authToken")
$msg = $twilio.SendSmsMessage("+15551112222", "+15553334444", "Can you believe it's this easy to send an SMS?!")
// v2
Add-Type -path "Twilio.Api.dll"
$twilio = new-object Twilio.TwilioRestClient("accountSid", "authToken")
$msg = $twilio.SendSmsMessage("+15551112222", "+15553334444", "Can you believe it's this easy to send an SMS?!")
@aaronlerch
Copy link

@drmohundro
Copy link

One fix, in Powershell v2, instead of [System.Reflection.Assembly]::LoadFile("path to twilio assembly") | out-null, you can use Add-Type -path "path to twilio assembly"

@aaronlerch
Copy link

Nice!

@jewer
Copy link

jewer commented Aug 25, 2011

$twilio = new-object Twilio.TwilioRestClient("accountSid", "authToken")
$msg = twilio.SendSmsMessage("+15551112222", "+15553334444", "Can you believe it's this easy to send an SMS with powershell too?!")

@jewer
Copy link

jewer commented Aug 25, 2011

crap. no auto refresh in gist. well, what he said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment