Created
February 4, 2015 17:36
-
-
Save dangerouse/ef3b9a3eae39b53740b6 to your computer and use it in GitHub Desktop.
CloudSponge Widget Example - Web Hooks (using jquery)
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<!-- Any link with a class="cs_import" will start the import process --> | |
<a class="cs_import">Add from Address Book</a> | |
<!-- Include the script anywhere on your page --> | |
<script> | |
// set any options here, for this example, we'll simply populate the contacts in the textarea above | |
window.csPageOptions = { | |
// don't include the domain_key here, it's part of your widget script, below | |
afterSubmitContacts: function(contacts, source, owner) { | |
var webhookURL = "THE WEB HOOK URL", | |
data = {contacts: contacts, source: source, owner: owner}; | |
$.post(webhookURL, data); | |
} | |
}; | |
// Asynchronously include the widget library. | |
(function(u){ | |
var d=document,s='script',a=d.createElement(s),m=d.getElementsByTagName(s)[0]; | |
a.async=1;a.src=u;m.parentNode.insertBefore(a,m); | |
})('//api.cloudsponge.com/widget/YOUR_WIDGET_SCRIPT.js'); | |
</script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment