mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
added email in vcard
This commit is contained in:
parent
41f191902b
commit
b7da8d2193
@ -380,6 +380,7 @@ export const contactMessageSchema: JSONSchema7 = {
|
||||
},
|
||||
phoneNumber: { type: 'string', minLength: 10 },
|
||||
organization: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
},
|
||||
required: ['fullName', 'wuid', 'phoneNumber'],
|
||||
...isNotEmpty('fullName'),
|
||||
|
@ -126,6 +126,7 @@ export class ContactMessage {
|
||||
wuid: string;
|
||||
phoneNumber: string;
|
||||
organization?: string;
|
||||
email?: string;
|
||||
}
|
||||
export class SendContactDto extends Metadata {
|
||||
contactMessage: ContactMessage[];
|
||||
|
@ -1425,16 +1425,26 @@ export class WAStartupService {
|
||||
const message: proto.IMessage = {};
|
||||
|
||||
const vcard = (contact: ContactMessage) => {
|
||||
return (
|
||||
let result =
|
||||
'BEGIN:VCARD\n' +
|
||||
'VERSION:3.0\n' +
|
||||
`N:${contact.fullName}\n` +
|
||||
`FN:${contact.fullName}\n` +
|
||||
`ORG:${contact.organization};\n` +
|
||||
`FN:${contact.fullName}\n`;
|
||||
|
||||
if (contact.organization) {
|
||||
result += `ORG:${contact.organization};\n`;
|
||||
}
|
||||
|
||||
if (contact.email) {
|
||||
result += `EMAIL:${contact.email}\n`;
|
||||
}
|
||||
|
||||
result +=
|
||||
`item1.TEL;waid=${contact.wuid}:${contact.phoneNumber}\n` +
|
||||
'item1.X-ABLabel:Celular\n' +
|
||||
'END:VCARD'
|
||||
);
|
||||
'END:VCARD';
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
if (data.contactMessage.length === 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user