@@ -77,6 +77,7 @@ import {
7777 GlobalWebhook ,
7878 QrCode ,
7979 ProviderSession ,
80+ EnvProxy ,
8081} from '../../config/env.config' ;
8182import { Logger } from '../../config/logger.config' ;
8283import { INSTANCE_DIR , ROOT_DIR } from '../../config/path.config' ;
@@ -151,6 +152,7 @@ import {
151152 unlinkSync ,
152153 writeFileSync ,
153154} from 'fs' ;
155+ import { createProxyAgents } from '../../utils/proxy' ;
154156
155157type InstanceQrCode = {
156158 count : number ;
@@ -825,10 +827,10 @@ export class WAStartupService {
825827
826828 messagesRaw . push ( {
827829 keyId : m . key . id ,
828- keyRemoteJid : m . key ?. remoteJid || m . key ?. [ 'lid' ] ,
830+ keyRemoteJid : this . normalizeJid ( m . key ) ,
829831 keyFromMe : m . key . fromMe ,
830832 pushName : m ?. pushName || m . key . remoteJid . split ( '@' ) [ 0 ] ,
831- keyParticipant : m ?. participant || m . key ?. participant ,
833+ keyParticipant : m ?. participant || this . normalizeParticipant ( m . key ) ,
832834 messageType,
833835 content : m . message [ messageType ] as PrismType . Prisma . JsonValue ,
834836 messageTimestamp : timestamp ,
@@ -876,10 +878,11 @@ export class WAStartupService {
876878
877879 const messageRaw = {
878880 keyId : received . key . id ,
879- keyRemoteJid : received . key ?. remoteJid || received ? .key ?. [ 'lid' ] ,
881+ keyRemoteJid : this . normalizeJid ( received . key ) ,
880882 keyFromMe : received . key . fromMe ,
881883 pushName : received . pushName ,
882- keyParticipant : received ?. participant || received . key ?. participant ,
884+ keyParticipant :
885+ received ?. participant || this . normalizeParticipant ( received . key ) ,
883886 messageType,
884887 content : received . message [ messageType ] as PrismType . Prisma . JsonValue ,
885888 messageTimestamp : received . messageTimestamp ,
@@ -1183,6 +1186,14 @@ export class WAStartupService {
11831186 }
11841187 }
11851188
1189+ private normalizeJid ( key : proto . IMessageKey ) {
1190+ return key ?. remoteJid || key ?. [ 'remoteJidAlt' ] || key ?. [ 'lid' ] ;
1191+ }
1192+
1193+ private normalizeParticipant ( key : proto . IMessageKey ) {
1194+ return key ?. participant || key ?. [ 'participantAlt' ] ;
1195+ }
1196+
11861197 private createJid ( number : string ) : string {
11871198 if (
11881199 number . includes ( '@g.us' ) ||
0 commit comments