mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
🐛Fix update sales leads script URL encoding
This commit is contained in:
parent
07aad0ca18
commit
57e8e61b1c
1 changed files with 7 additions and 9 deletions
|
@ -40,15 +40,13 @@ findLeads((err, leads) => {
|
|||
console.error(err);
|
||||
return;
|
||||
}
|
||||
// TEMP
|
||||
// // TEMP
|
||||
// for (const email in leads) {
|
||||
// if (leads[email].coco_schoolName) {
|
||||
// console.log(email);
|
||||
// console.log(leads[email]);
|
||||
// // break;
|
||||
// }
|
||||
// console.log(email);
|
||||
// console.log(leads[email]);
|
||||
// break;
|
||||
// }
|
||||
// TEMP
|
||||
// // TEMP
|
||||
log(`Num leads created ${numLeadsCreated}`);
|
||||
log("Script runtime: " + (new Date() - scriptStartTime));
|
||||
});
|
||||
|
@ -187,7 +185,7 @@ function addIntercomData(leads, done) {
|
|||
}
|
||||
function getUser(email) {
|
||||
const options = {
|
||||
url: `https://api.intercom.io/users?email=${email}`,
|
||||
url: `https://api.intercom.io/users?email=${encodeURIComponent(email)}`,
|
||||
auth: {
|
||||
user: intercomAppId,
|
||||
pass: intercomApiKey
|
||||
|
@ -256,7 +254,7 @@ function updateLeads(leads, done) {
|
|||
});
|
||||
}
|
||||
function updateLead(email) {
|
||||
const url = `https://${closeIoApiKey}:X@app.close.io/api/v1/lead/?query=email_address:${email}`;
|
||||
const url = `https://${closeIoApiKey}:X@app.close.io/api/v1/lead/?query=email_address:${encodeURIComponent(email)}`;
|
||||
request.get(url, (error, response, body) => {
|
||||
if (error) return done(error);
|
||||
const data = JSON.parse(body);
|
||||
|
|
Loading…
Reference in a new issue