From d7016b794cc963ada07233a9efab7394bee0286a Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 19 Jun 2025 12:44:57 -0500 Subject: [PATCH] Website: Update receive-from-clay webhook. (#30153) Closes: https://github.com/fleetdm/confidential/issues/11058 Changes: - Updated the receive from clay webhook to log a warning and return a `couldNotCreateActivity` response if it receives information about a contact record with no account record associated with it. --- website/api/controllers/webhooks/receive-from-clay.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/api/controllers/webhooks/receive-from-clay.js b/website/api/controllers/webhooks/receive-from-clay.js index 8582433b50..103fcb0482 100644 --- a/website/api/controllers/webhooks/receive-from-clay.js +++ b/website/api/controllers/webhooks/receive-from-clay.js @@ -84,6 +84,11 @@ module.exports = { } }); + if(!recordIds.salesforceAccountId) { + sails.log.warn(`When the receive-from-clay received information about a user's activity (name: ${firstName} ${lastName}), activity: ${intentSignal}). A contact was successfully updated, but the webhook is unable to continue because this contact is not associated with any Salesforce account record. Contact ID: ${recordIds.salesforceContactId}`); + throw 'couldNotCreateActivity'; + } + let trimmedLinkedinUrl = linkedinUrl.replace(sails.config.custom.RX_PROTOCOL_AND_COMMON_SUBDOMAINS, ''); // Create the new Fleet website page view record.