Skip to content

Commit 85a95a0

Browse files
committed
updated email notify
1 parent de44910 commit 85a95a0

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

src/server/services/recruitCRM.js

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { logger } from 'topcoder-react-lib';
99
import Joi from 'joi';
1010
import GrowsurfService from './growsurf';
1111
import { sendEmailDirect } from './sendGrid';
12-
import GSheetService from './gSheet';
12+
// import GSheetService from './gSheet';
1313

1414
const FormData = require('form-data');
1515

@@ -480,18 +480,32 @@ export default class RecruitCRMService {
480480
// aka triggered referral state step 1 - notify and etc. housekeeping tasks
481481
if (isNewCandidate && isReferred && !growRes.error) {
482482
// update the tracking sheet
483-
const gs = new GSheetService();
484-
await gs.addToSheet(config.GIG_REFERRALS_SHEET, [[
485-
`${form.first_name} ${form.last_name}`,
486-
form.email,
487-
`https://app.recruitcrm.io/candidate/${candidateData.slug}`,
488-
`https://topcoder.com/members/${form.custom_fields[tcHandle].value}`,
489-
`https://app.growsurf.com/dashboard/campaign/u9frbx/participant/${growRes.referrer.id}`,
490-
`${growRes.referrer.firstName} ${growRes.referrer.lastName}`,
491-
growRes.referrer.email,
492-
`https://topcoder.com/members/${growRes.referrer.metadata.tcHandle}`,
493-
`https://app.recruitcrm.io/job/${id}`,
494-
]]);
483+
// enable that code when issue with service account key structure is resolved
484+
// const gs = new GSheetService();
485+
// await gs.addToSheet(config.GIG_REFERRALS_SHEET, [[
486+
// `${form.first_name} ${form.last_name}`,
487+
// form.email,
488+
// `https://app.recruitcrm.io/candidate/${candidateData.slug}`,
489+
// `https://topcoder.com/members/${form.custom_fields[tcHandle].value}`,
490+
// `https://app.growsurf.com/dashboard/campaign/u9frbx/participant/${growRes.referrer.id}`,
491+
// `${growRes.referrer.firstName} ${growRes.referrer.lastName}`,
492+
// growRes.referrer.email,
493+
// `https://topcoder.com/members/${growRes.referrer.metadata.tcHandle}`,
494+
// `https://app.recruitcrm.io/job/${id}`,
495+
// ]]);
496+
// Notify the person who referred
497+
sendEmailDirect({
498+
personalizations: [
499+
{
500+
to: [{ email: growRes.referrer.email }],
501+
subject: 'Thanks for your Topcoder referral!',
502+
},
503+
],
504+
from: { email: 'noreply@topcoder.com', name: 'The Topcoder Community Team' },
505+
content: [{
506+
type: 'text/html', value: `<p>Hello ${growRes.referrer.metadata.tcHandle},<p/><p>You just made our day! Sharing a Topcoder Gig Work opportunity is the BEST compliment you can give us. So pat yourself on the back, give yourself a hi-five, or just stand up and dance like no one is watching. You deserve it!</p><p>Did you know many of our Topcoder members consider earning through Topcoder to be life changing? There must be <a href="https://www.youtube.com/watch?v=8J7yTze4Xbs" target="_blank">something in the air</a>. You have just taken the first step into helping someone you know change their life for the better.</p><p>Because of that, we are excited to reward you. $500 is earned for every referral you send us that gets the gig. <a href="https://www.topcoder.com/community/gig-referral">Learn more here</a>.</p><p>Thank you for sharing Topcoder Gigs and hope to see you around here again soon!</p><p>- The Topcoder Community Team</p>`,
507+
}],
508+
});
495509
}
496510
// respond to API call
497511
const data = await applyResponse.json();

0 commit comments

Comments
 (0)