-
-
Save nielsfogt/d9d5ce702f6bc4b2e1218791de381b9b 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