Last active
August 28, 2018 18:16
-
-
Save jillbert/25c6c54dc2c46f9aea19c00996041b76 to your computer and use it in GitHub Desktop.
Push Zapier JS Variables to NationBuilder
This file contains hidden or 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
var apiUrl = 'https://YOUR_NATION_URL.nationbuilder.com/api/v1/people/push?access_token=YOUR_ACCESS_TOKEN'; | |
var data = JSON.stringify({ | |
"person":{ | |
"email":inputData.email, | |
"first_name":inputData.first_name, | |
"last_name":inputData.last_name, | |
"external_id":inputData.id, | |
"tags":[inputData.purchase], | |
} | |
}); | |
fetch(apiUrl, { | |
method: 'PUT', | |
body: data, | |
headers: { | |
"Content-Type": "application/json", | |
} | |
}) | |
.then(function(res) { | |
return res.json(); | |
}) | |
.then(function(body) { | |
var output = body; | |
callback(null, output); | |
}) | |
.catch(callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment