mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
fix: Adjusts to receive contact with more numbers
This commit is contained in:
parent
8c7b0698f3
commit
6727b1cfca
@ -1174,6 +1174,7 @@ export class ChatwootService {
|
||||
const result = typeKey ? types[typeKey] : undefined;
|
||||
|
||||
if (typeKey === 'contactMessage') {
|
||||
console.log(result);
|
||||
const vCardData = result.split('\n');
|
||||
const contactInfo = {};
|
||||
|
||||
@ -1184,13 +1185,17 @@ export class ChatwootService {
|
||||
}
|
||||
});
|
||||
|
||||
const telKey = Object.keys(contactInfo).find((key) =>
|
||||
key.startsWith('item1.TEL;waid='),
|
||||
);
|
||||
let formattedContact = `**Contact:**
|
||||
**name:** ${contactInfo['FN']}`;
|
||||
|
||||
const formattedContact = `**Contact:**
|
||||
**name:** ${contactInfo['FN']}
|
||||
**number:** ${contactInfo[telKey]}`;
|
||||
let numberCount = 1;
|
||||
Object.keys(contactInfo).forEach((key) => {
|
||||
if (key.startsWith('item') && key.includes('TEL;waid=')) {
|
||||
const phoneNumber = contactInfo[key];
|
||||
formattedContact += `\n**number ${numberCount}:** ${phoneNumber}`;
|
||||
numberCount++;
|
||||
}
|
||||
});
|
||||
|
||||
this.logger.verbose('message content: ' + formattedContact);
|
||||
return formattedContact;
|
||||
@ -1208,13 +1213,17 @@ export class ChatwootService {
|
||||
}
|
||||
});
|
||||
|
||||
const telKey = Object.keys(contactInfo).find((key) =>
|
||||
key.startsWith('item1.TEL;waid='),
|
||||
);
|
||||
let formattedContact = `**Contact:**
|
||||
**name:** ${contact.displayName}`;
|
||||
|
||||
const formattedContact = `**Contact:**
|
||||
**name:** ${contact.displayName}
|
||||
**number:** ${contactInfo[telKey]}`;
|
||||
let numberCount = 1;
|
||||
Object.keys(contactInfo).forEach((key) => {
|
||||
if (key.startsWith('item') && key.includes('TEL;waid=')) {
|
||||
const phoneNumber = contactInfo[key];
|
||||
formattedContact += `\n**number ${numberCount}:** ${phoneNumber}`;
|
||||
numberCount++;
|
||||
}
|
||||
});
|
||||
|
||||
return formattedContact;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user