Created
May 2, 2018 23:01
-
-
Save francisbrero/bbea0b44dc8e0482e254a7a14b3588dc to your computer and use it in GitHub Desktop.
Score leads directly in Google Sheets
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
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