Skip to content

Instantly share code, notes, and snippets.

@scottbaggett
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save scottbaggett/8853401 to your computer and use it in GitHub Desktop.

Select an option

Save scottbaggett/8853401 to your computer and use it in GitHub Desktop.
$.ajax({
url: url,
type: "POST",
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(waterfallCredentials),
success: (function(_this) {
return function(response) {
var mobileNum, payload, url;
console.log('successful authentication to waterfall', response);
mobileNum = _this.$mobile.val().match(/\d/g).join("");
url = 'http://three.waterfallmobile.com/api/v1/messaging/sendContent';
payload = {
"modules": [
{
"type": "SUBSCRIPTION",
"params": {
"listId": "52eff91c0cf22e9cd391bd16",
"optInType": "doubleOptIn",
"optInMessage": "Reply Y to Join!",
"confirmMessage": "Thanks. Message & Data Rates May Apply. Text STOP to end"
}
}
],
"msisdns": [mobileNum]
};
return $.ajax({
url: url,
type: "POST",
dataType: "json",
data: JSON.stringify(payload),
success: function(response) {
return log("succesful mobile payload.");
}
});
};
})(this)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment