Skip to content

Instantly share code, notes, and snippets.

@jillbert
Last active August 28, 2018 18:16
Show Gist options
  • Save jillbert/25c6c54dc2c46f9aea19c00996041b76 to your computer and use it in GitHub Desktop.
Save jillbert/25c6c54dc2c46f9aea19c00996041b76 to your computer and use it in GitHub Desktop.
Push Zapier JS Variables to NationBuilder
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