diff --git a/handlers/SalesforceAgentAssignedHandler.ts b/handlers/SalesforceAgentAssignedHandler.ts index 9ad56b9..c30a1ba 100644 --- a/handlers/SalesforceAgentAssignedHandler.ts +++ b/handlers/SalesforceAgentAssignedHandler.ts @@ -20,8 +20,13 @@ export class SalesforceAgentAssigned { ) {} public async exec() { + const technicalDifficultyMessage: string = await getAppSettingValue(this.read, AppSettingId.TECHNICAL_DIFFICULTY_MESSAGE); const salesforceBotUsername: string = await getAppSettingValue(this.read, AppSettingId.SALESFORCE_BOT_USERNAME); if (this.data.agent.username !== salesforceBotUsername) { + if (this.data.room.customFields?.isHandedOverFromDialogFlow === true) { + await sendLCMessage(this.read, this.modify, this.data.room, technicalDifficultyMessage, this.data.agent); + await this.modify.getUpdater().getLivechatUpdater().closeRoom(this.data.room, ErrorLogs.APP_CONFIGURATION_INVALID); + } return; } @@ -29,7 +34,6 @@ export class SalesforceAgentAssigned { const persistedData = await retrievePersistentTokens(this.read, assoc); const { persistentAffinity, persistentKey } = persistedData; const salesforceAgentName = (await retrievePersistentData(this.read, assoc)).salesforceAgentName; - const technicalDifficultyMessage: string = await getAppSettingValue(this.read, AppSettingId.TECHNICAL_DIFFICULTY_MESSAGE); let salesforceChatApiEndpoint: string = await getAppSettingValue(this.read, AppSettingId.SALESFORCE_CHAT_API_ENDPOINT); try {