Skip to content

Instantly share code, notes, and snippets.

@twilio
Created April 13, 2010 20:29
Show Gist options
  • Save twilio/365046 to your computer and use it in GitHub Desktop.
Save twilio/365046 to your computer and use it in GitHub Desktop.
<%
' replace with your account's settings
' available in the Dashboard
accountSid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
authToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
' setup the URL
baseUrl = "https://api.twilio.com"
smsUrl = baseUrl & "/2008-08-01/Accounts/" & accountSid & "/SMS/Messages"
' setup the request and authorization
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.open "POST", smsUrl, False, accountSid, authToken
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' message parameters
from = "your-number-here" ' the number to send the message from
recipient = "recipient-number-here" ' the number to send the message to
body = "Sending SMS is easy with Twilio!" ' message contents
postData = "From=" & Server.URLEncode(from)
postData = postData & "&To=" & Server.URLEncode(recipient)
postData = postData & "&Body=" & Server.URLEncode(body)
' send the POST data
http.send postData
' optionally write out the response if you need to check if it worked
' Response.Write http.responseText
' clean up
Set http = Nothing
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment