Created
January 21, 2015 22:07
-
-
Save mvilrokx/e919be7e814b142222d8 to your computer and use it in GitHub Desktop.
Calling the Twilio SMS API
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
var twilio = { | |
username: <your-twilio-username>, | |
pwd: <your-twilio-pwd>, | |
phone: <your-twilio-phone-number>, | |
server_url: 'https://api.twilio.com/2010-04-01/Accounts/' | |
}; | |
var user = { | |
phone: <user-phone-number> | |
}; | |
if ($("#sms").is(':checked')) { | |
$.ajax({ | |
type: "POST", | |
username: twilio.username, | |
password: twilio.pwd, | |
url: twilio.server_url + twilio.username + '/Messages.json', | |
data: { Body: event.target.innerText, From: twilio.phone, To: user.phone } | |
}) | |
.done(function( msg ) { | |
console.log("Message Send"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment