mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
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:
parent
84715f4b19
commit
9d8d9b669e
1 changed files with 8 additions and 2 deletions
|
|
@ -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';
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue