Skip to content

Instantly share code, notes, and snippets.

@boomtrain-support
Created September 1, 2015 23:55
Show Gist options
  • Save boomtrain-support/ec0a480204d1b3f8f220 to your computer and use it in GitHub Desktop.
Save boomtrain-support/ec0a480204d1b3f8f220 to your computer and use it in GitHub Desktop.
POST /unsubscribe - Unsubscribe a User from all Campaigns using jQuery
<script>
// Unsubscribe a User by email address
function postUnsubscribe() {
// JSON stringify the email address
var json_email = JSON.stringify({
email: emailAddr
});
// Send a jQuery AJAX request to unsubscribe the email address.
$.ajax({
url: 'https://api.boomtrain.com/unsubscribe',
// Replace with your Username, Password, and App Id
headers: {
'x-app-id': '{app_id}',
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('{username}:{password}')
},
type: 'POST',
data: json_email,
success: function(msg) {
console.log(msg);
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment