Skip to content

Instantly share code, notes, and snippets.

@bubbafat
Created April 3, 2010 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bubbafat/354125 to your computer and use it in GitHub Desktop.
Save bubbafat/354125 to your computer and use it in GitHub Desktop.
Twilio and RestSharp to send SMS
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