Created
September 13, 2019 23:39
-
-
Save nielsfogt/69e8d1500616be7cb4bb31f57f0fa52e to your computer and use it in GitHub Desktop.
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
form.onSuccess(function(vals) { | |
var visitorId = Intercom("getVisitorId"); | |
var payload = JSON.stringify({ | |
anonId: visitorId, | |
vals: vals | |
}); | |
// Setup our http client | |
var xhttp = new XMLHttpRequest(); | |
// Add Public Workflow URL from Tray Platform webhook workflow. | |
xhttp.open("POST", "TRAY_WEBHOOK_URL", true); | |
// Set a few request headers | |
xhttp.setRequestHeader("Content-type", "application/json"); | |
xhttp.setRequestHeader("X-CSRF-Token", "YOUR_TOKEN"); | |
// Send payload to the Tray Platform, bon voyage! | |
xhttp.send(payload); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment