mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
🐛Fix Close.io lead query by name
This commit is contained in:
parent
7a49eb4c77
commit
8f16f5f487
1 changed files with 10 additions and 4 deletions
|
@ -343,8 +343,14 @@ function createAddIntercomDataFn(lead, email) {
|
|||
};
|
||||
request.get(options, (error, response, body) => {
|
||||
if (error) return done(error);
|
||||
const user = JSON.parse(body);
|
||||
lead.addIntercomUser(email, user);
|
||||
try {
|
||||
const user = JSON.parse(body);
|
||||
lead.addIntercomUser(email, user);
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
console.log(body);
|
||||
}
|
||||
return done();
|
||||
});
|
||||
};
|
||||
|
@ -455,7 +461,8 @@ function saveNewLead(lead, done) {
|
|||
function createUpdateLeadFn(lead) {
|
||||
return (done) => {
|
||||
// console.log('DEBUG: updateLead', lead.name);
|
||||
const url = `https://${closeIoApiKey}:X@app.close.io/api/v1/lead/?query=name:${encodeURIComponent(lead.name)}`;
|
||||
const query = `name:"${lead.name}"`;
|
||||
const url = `https://${closeIoApiKey}:X@app.close.io/api/v1/lead/?query=${encodeURIComponent(query)}`;
|
||||
request.get(url, (error, response, body) => {
|
||||
if (error) return done(error);
|
||||
try {
|
||||
|
@ -576,7 +583,6 @@ function sendMail(toEmail, leadId, contactId, template, done) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function updateLeads(leads, done) {
|
||||
const tasks = []
|
||||
for (const name in leads) {
|
||||
|
|
Loading…
Reference in a new issue