Skip to content

Instantly share code, notes, and snippets.

@devinrader
Forked from twilio/gist:365049
Last active April 6, 2017 01:03
Show Gist options
  • Save devinrader/2614dd791cec308ec598d3c8ae2dc5c3 to your computer and use it in GitHub Desktop.
Save devinrader/2614dd791cec308ec598d3c8ae2dc5c3 to your computer and use it in GitHub Desktop.
<%
' replace with your account's settings
' available in the Dashboard
accountSid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
authToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
' setup the URL
baseUrl = "https://api.twilio.com"
msgUrl = baseUrl & "/2010-04-01/Accounts/" & accountSid & "/Messages"
' setup the request and authorization
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.open "POST", msgUrl, False, accountSid, authToken
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' call parameters
caller = "your-number-here" ' the number to call from
called = "recipient-number-here" ' the number to dial
body = "message-here" ' The text of the message
mediaUrl = "media-url-here" ' URL of the media you want to include
postData = "Caller=" & Server.URLEncode(caller)
postData = postData & "&Called=" & Server.URLEncode(called)
postData = postData & "&Body=" & Server.URLEncode(body)
postData = postData & "&MediaUrl=" & Server.URLEncode(mediaUrl)
' 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