diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index 8b8f229f..b667a51d 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -104,7 +104,8 @@ export class FeedbackDialog extends IGBDialog { await min.userProfile.set(step.context, profile); - if (agentSystemId.charAt(2) === ':' || agentSystemId.indexOf('@') > -1) { + if (agentSystemId.indexOf('@') !== -1) { + // Agent is from Teams or Google Chat. const agent = await sec.getUserFromSystemId(agentSystemId); @@ -181,7 +182,7 @@ export class FeedbackDialog extends IGBDialog { step.context.activity.conversation.id ); - if (user.agentSystemId.charAt(2) === ':' || userSystemId.indexOf('@') > -1) { + if (user.agentSystemId.indexOf('@') !== -1) { // Agent is from Teams or Google Chat. await min.conversationalService.sendText( min, diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 37238963..87e76630 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -516,7 +516,8 @@ export class WhatsappDirectLine extends GBService { null ); - if (user.agentSystemId.charAt(2) === ':') { + if (user.agentSystemId.indexOf('@') !== -1) { + // Agent is from Teams. await this.min.conversationalService['sendOnConversation']( this.min, @@ -535,7 +536,7 @@ export class WhatsappDirectLine extends GBService { await sec.updateHumanAgent(user.agentSystemId, this.min.instance.instanceId, null); } else { GBLog.info(`HUMAN AGENT (${manualUser.agentSystemId}) TO USER ${manualUser.userSystemId}: ${text}`); - await this.sendToDeviceEx(manualUser.userSystemId, `AGENTE: *${text}*`, locale, null); + await this.sendToDeviceEx(manualUser.userSystemId, `AGENT: *${text}*`, locale, null); } } } else if (user.agentMode === 'human') { @@ -552,7 +553,7 @@ export class WhatsappDirectLine extends GBService { } else { GBLog.info(`USER (${from}) TO AGENT ${agent.userSystemId}: ${text}`); - if (user.agentSystemId.charAt(2) === ':' || agent.userSystemId.indexOf('@') > -1) { + if (user.agentSystemId.indexOf('@') !== -1) { // Agent is from Teams or Google Chat. await this.min.conversationalService['sendOnConversation'](this.min, agent, text); } else { @@ -593,16 +594,21 @@ export class WhatsappDirectLine extends GBService { } private async endTransfer(id: string, locale: string, user: GuaribasUser, agent: GuaribasUser, sec: SecService) { + await this.sendToDeviceEx(id, Messages[this.locale].notify_end_transfer(this.min.instance.botId), locale, null); - if (user.agentSystemId.charAt(2) === ':') { + if (user.agentSystemId.indexOf('@') !== -1) { + // Agent is from Teams. + await this.min.conversationalService['sendOnConversation']( this.min, agent, Messages[this.locale].notify_end_transfer(this.min.instance.botId) ); + } else { + await this.sendToDeviceEx( user.agentSystemId, Messages[this.locale].notify_end_transfer(this.min.instance.botId),