Website: Update receive-from-clay webhook exits (#33185)

Changes:
- Added two exits to the `receive-from-clay` webhook that are used if
the webhook receives invalid inputs for the CRM helpers it uses.
This commit is contained in:
Eric 2025-09-18 16:20:04 -05:00 committed by GitHub
parent 84715f4b19
commit 9d8d9b669e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,6 +54,8 @@ module.exports = {
duplicateContactOrAccountFound: {description: 'A contact or account could not be created because a duplicate record exists.', statusCode: 409 },
couldNotCreateContactOrAccount: { description: 'A contact or account could not be created in the CRM using the provided information.' },
couldNotCreateActivity: { description: 'An error occured when trying to create a historical event record in the CRM' },
invalidContactOrAccountCriteria: { description: 'A contact or account could not be created in the CRM using the provided information.', responseType: 'badRequest' },
invalidHistoricalEventCriteria: { description: 'A historical could not be created in the CRM using the provided information.', responseType: 'badRequest' },
},
@ -75,7 +77,9 @@ module.exports = {
linkedinUrl,
contactSource,
jobTitle,
}).intercept((err)=>{
})
.intercept({name: 'UsageError'}, 'invalidContactOrAccountCriteria')
.intercept((err)=>{
sails.log.warn(`When the receive-from-clay webhook received information about LinkedIn activity, a contact/account could not be created or updated. Full error: ${require('util').inspect(err)}`);
if(typeof err.errorCode !== 'undefined' && err.errorCode === 'DUPLICATES_DETECTED') {
return 'duplicateContactOrAccountFound';
@ -100,7 +104,9 @@ module.exports = {
eventContent: historicalContent,
eventContentUrl: historicalContentUrl,
linkedinUrl: trimmedLinkedinUrl,
}).intercept((err)=>{
})
.intercept({name: 'UsageError'}, 'invalidHistoricalEventCriteria')
.intercept((err)=>{
sails.log.warn(`When the receive-from-clay webhook received information about LinkedIn activity, a historical event record could not be created. Full error: ${require('util').inspect(err)}`);
return 'couldNotCreateActivity';
});