diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 4abb323a..cf10a30d 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -1085,7 +1085,10 @@ export class GBMinService { } } - let pid = step.context.activity['pid']; + let pid = step.context.activity['pid'] ? + step.context.activity['pid'] : + step.context.activity.from['pid']; + let recipient = context.activity?.recipient?.id; if (!pid && recipient !== min.botId) { @@ -1143,7 +1146,7 @@ export class GBMinService { GBLogEx.info( min, - `Input> ${context.activity.text} (type: ${context.activity.type}, name: ${context.activity.name}, channelId: ${context.activity.channelId})` + `Human: pid:${pid} ${context.activity.text} (type: ${context.activity.type}, name: ${context.activity.name}, channelId: ${context.activity.channelId})` ); // Answer to specific BOT Framework event conversationUpdate to auto start dialogs. diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 079eb7b3..755c4df3 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -556,9 +556,9 @@ export class WhatsappDirectLine extends GBService { WhatsappDirectLine.chatIds[generatedConversationId] = message?.chatId; this.pollMessages(client, generatedConversationId, from, fromName); - this.inputMessage(client, generatedConversationId, text, from, fromName, group, attachments); + this.inputMessage(client, generatedConversationId, text, from, fromName, group, attachments, pid); } else { - this.inputMessage(client, conversationId, text, from, fromName, group, attachments); + this.inputMessage(client, conversationId, text, from, fromName, group, attachments, null); } } else { GBLog.warn(`Inconsistencty found: Invalid agentMode on User Table: ${user.agentMode}`); @@ -592,7 +592,7 @@ export class WhatsappDirectLine extends GBService { await sec.updateHumanAgent(id, this.min.instance.instanceId, null); } - public inputMessage(client, conversationId: string, text: string, from, fromName: string, group, attachments: File) { + public inputMessage(client, conversationId: string, text: string, from, fromName: string, group, attachments: File, pid = null) { try { return client.apis.Conversations.Conversations_PostActivity({ conversationId: conversationId, @@ -610,6 +610,7 @@ export class WhatsappDirectLine extends GBService { id: from, name: fromName, channelIdEx: 'whatsapp', + pid: pid, group: group }, replyToId: from