diff --git a/website/api/controllers/entrance/signup.js b/website/api/controllers/entrance/signup.js index ff50aabddd..dd62d799a5 100644 --- a/website/api/controllers/entrance/signup.js +++ b/website/api/controllers/entrance/signup.js @@ -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({