diff --git a/functions/taskrouterListeners/createHrmContactListener.private.ts b/functions/taskrouterListeners/createHrmContactListener.private.ts index 763e5fd1..f3fc2f8f 100644 --- a/functions/taskrouterListeners/createHrmContactListener.private.ts +++ b/functions/taskrouterListeners/createHrmContactListener.private.ts @@ -138,6 +138,13 @@ export const handleEvent = async ( }, }; const response = await fetch(`${hrmBaseAccountUrl}/contacts`, options); + if (!response.ok) { + console.error( + `Failed to create HRM contact for task ${taskSid} - status: ${response.status} - ${response.statusText}`, + await response.text(), + ); + return; + } const { id }: HrmContact = await response.json(); console.info(`Created HRM contact with id ${id} for task ${taskSid}`); };