mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
fix(chatwoot.service): improve number retrieval logic for message senders
- Enhanced the logic for retrieving sender numbers by introducing a new method that prioritizes senderPn, followed by participant and remoteJid. - This change ensures more reliable identification of message senders across different scenarios.
This commit is contained in:
parent
534c54a171
commit
c17b48bca0
@ -569,7 +569,12 @@ export class ChatwootService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If it doesn't have @lid, return the normal number
|
// If it doesn't have @lid, return the normal number
|
||||||
return msg.key.participant?.split('@')[0] || msg.key.remoteJid?.split('@')[0];
|
// Try to get the number from senderPn first, then participant, then remoteJid
|
||||||
|
const getNumber = (value: string) => {
|
||||||
|
return value?.includes('@s.whatsapp.net') ? value.split('@')[0] : value;
|
||||||
|
};
|
||||||
|
|
||||||
|
return getNumber(msg.key.senderPn) || getNumber(msg.key.participant) || getNumber(msg.key.remoteJid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createConversation(instance: InstanceDto, body: any) {
|
public async createConversation(instance: InstanceDto, body: any) {
|
||||||
|
Loading…
Reference in New Issue
Block a user