Created
April 3, 2010 04:48
-
-
Save bubbafat/354125 to your computer and use it in GitHub Desktop.
Twilio and RestSharp to send SMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private RestResponse SendSms(string sid, string token, string to, string from, string key, string msg) | |
{ | |
var client = new RestClient("https://api.twilio.com") | |
{ | |
Authenticator = new HttpBasicAuthenticator(sid, token), | |
}; | |
var request = new RestRequest | |
{ | |
Method = Method.POST, | |
Resource = string.Format("2008-08-01/Accounts/{0}/SMS/Messages", sid), | |
}; | |
request.AddParameter("From", from); | |
request.AddParameter("To", to); | |
request.AddParameter("Body", msg); | |
return client.Execute(request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment