Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save francisbrero/bbea0b44dc8e0482e254a7a14b3588dc to your computer and use it in GitHub Desktop.
Save francisbrero/bbea0b44dc8e0482e254a7a14b3588dc to your computer and use it in GitHub Desktop.
Score leads directly in Google Sheets
function mk_score_person(email, api_key, use_beta) {
url = 'https://api.madkudu.com/v1/persons?email=' + email;
var params = {
"method":"GET",
"contentType": "application/json",
"headers": {"Authorization" : "Basic " + Utilities.base64Encode(api_key + ':')}
};
var response = UrlFetchApp.fetch(url, params);
var json_data = JSON.parse(response.getContentText());
return format_api_response(json_data);
}
function format_api_response(json_data) {
return [[
json_data.properties.customer_fit.segment,
json_data.properties.customer_fit.score
]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment