Skip to content

Commit

Permalink
Merge pull request #56 from WideChat/feature/add-bot-offline-failure-log
Browse files Browse the repository at this point in the history
Add Log escalation failure if SF bot is offline/disabled
  • Loading branch information
ear-dev authored Apr 29, 2021
2 parents 198091f + a0a7d60 commit d3a1b0b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down

0 comments on commit d3a1b0b

Please sign in to comment.