Website: Update signup.js (#17470)

Related to: https://github.com/fleetdm/confidential/issues/5695

Changes:
- Updated `signup.js` to send a request to Zapier.
This commit is contained in:
Eric 2024-03-11 10:48:41 -05:00 committed by GitHub
parent fdcf255d6c
commit 94cd621360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,9 +128,29 @@ the account verification message.)`,
.intercept({name: 'UsageError'}, 'invalid')
.fetch();
// Send a POST request to Zapier
await sails.helpers.http.post.with({
url: 'https://hooks.zapier.com/hooks/catch/3627242/30bq2ib/',
data: {
newEmailAddress,
firstName,
lastName,
organization,
signupReason,
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 submitted a contact form message, a lead/contact could not be updated in the CRM for this email address: ${newEmailAddress}. Raw error: ${err}`);
return;
});
// Store the user's new id in their session.
this.req.session.userId = newUserRecord.id;
if (sails.config.custom.verifyEmailAddresses) {
// Send "confirm account" email
await sails.helpers.sendTemplateEmail.with({