Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion handlers/SalesforceAgentAssignedHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ 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;
}

const assoc = getRoomAssoc(this.data.room.id);
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 {
Expand Down