diff --git a/lib/Room.ts b/lib/Room.ts index 0e81683..9e4ad84 100644 --- a/lib/Room.ts +++ b/lib/Room.ts @@ -87,7 +87,16 @@ export const performHandover = async (modify: IModify, read: IRead, rid: string, await removeBotTypingListener(rid); if (!result) { - const offlineMessage: string = await getAppSettingValue(read, AppSetting.DialogflowServiceUnavailableMessage); + const offlineMessage: string = await getAppSettingValue(read, AppSetting.DialogflowServiceUnavailableMessage), + handoverFailure = { + error: offlineMessage, + errorMessage: 'Unable to reach Liveagent bot, it may be offline or disabled.', + dialogflow_SessionID: rid, + visitorDetails: (({ id, token }) => ({ id, token }))(visitor), + targetDepartment: livechatTransferData.targetDepartment + } + + console.log('Failed to handover', JSON.stringify(handoverFailure)); await createMessage(rid, read, modify, { text: offlineMessage ? offlineMessage : DefaultMessage.DEFAULT_DialogflowHandoverFailedMessage });