mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
Website: Update /start questionnaire to update leads (#18120)
Changes: - Updated the `save-questionnaire-progress` to send a request to Zapier when a user completes the "What are you using Fleet for" step of the /start questionnaire.
This commit is contained in:
parent
b9ef0290b9
commit
d89af24955
2 changed files with 17 additions and 1 deletions
|
|
@ -59,6 +59,22 @@ module.exports = {
|
|||
await User.updateOne({id: this.req.me.id}).set({
|
||||
primaryBuyingSituation
|
||||
});
|
||||
// Send a POST request to Zapier
|
||||
await sails.helpers.http.post.with({
|
||||
url: 'https://hooks.zapier.com/hooks/catch/3627242/3pl7yt1/',
|
||||
data: {
|
||||
primaryBuyingSituation,
|
||||
emailAddress: this.req.me.emailAddress,
|
||||
webhookSecret: sails.config.custom.zapierSandboxWebhookSecret,
|
||||
}
|
||||
})
|
||||
.timeout(5000)
|
||||
.tolerate(['non200Response', 'requestFailed'], (err)=>{
|
||||
// Note that Zapier responds with a 2xx status code even if something goes wrong, so just because this message is not logged doesn't mean everything is hunky dory. More info: https://github.com/fleetdm/fleet/pull/6380#issuecomment-1204395762
|
||||
sails.log.warn(`When a user completed the 'What are you using Fleet for' questionnaire step, a lead/contact could not be updated in the CRM for this email address: ${this.req.me.emailAddress}. Raw error: ${err}`);
|
||||
return;
|
||||
});
|
||||
|
||||
// Set the primary buying situation in the user's session.
|
||||
this.req.session.primaryBuyingSituation = primaryBuyingSituation;
|
||||
}
|
||||
|
|
|
|||
2
website/assets/js/pages/start.page.js
vendored
2
website/assets/js/pages/start.page.js
vendored
|
|
@ -75,7 +75,7 @@ parasails.registerPage('start', {
|
|||
}
|
||||
// If this user has not completed the 'what are you using fleet for' step, and has a primaryBuyingSituation set by an ad. prefill the formData for this step.
|
||||
if(this.primaryBuyingSituation && _.isEmpty(this.formData['what-are-you-using-fleet-for'])){
|
||||
this.formData['what-are-you-using-fleet-for'].primaryBuyingSituation = _.clone(this.primaryBuyingSituation);
|
||||
this.formData['what-are-you-using-fleet-for'] = {primaryBuyingSituation: this.primaryBuyingSituation};
|
||||
}
|
||||
},
|
||||
mounted: async function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue