Skip to content

Commit a5e2975

Browse files
committed
added organization name in vcard
1 parent 964427e commit a5e2975

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

src/validate/validate.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ export const contactMessageSchema: JSONSchema7 = {
379379
description: '"wuid" must be a numeric string',
380380
},
381381
phoneNumber: { type: 'string', minLength: 10 },
382+
organization: { type: 'string' },
382383
},
383384
required: ['fullName', 'wuid', 'phoneNumber'],
384385
...isNotEmpty('fullName'),

src/whatsapp/dto/sendMessage.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export class ContactMessage {
125125
fullName: string;
126126
wuid: string;
127127
phoneNumber: string;
128+
organization?: string;
128129
}
129130
export class SendContactDto extends Metadata {
130131
contactMessage: ContactMessage[];

src/whatsapp/services/whatsapp.service.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,20 +1425,15 @@ export class WAStartupService {
14251425
const message: proto.IMessage = {};
14261426

14271427
const vcard = (contact: ContactMessage) => {
1428-
return (
1428+
const result =
14291429
'BEGIN:VCARD\n' +
14301430
'VERSION:3.0\n' +
1431-
'FN:' +
1432-
contact.fullName +
1433-
'\n' +
1434-
'item1.TEL;waid=' +
1435-
contact.wuid +
1436-
':' +
1437-
contact.phoneNumber +
1438-
'\n' +
1439-
'item1.X-ABLabel:Celular\n' +
1440-
'END:VCARD'
1441-
);
1431+
`FN:${contact.fullName}\n` +
1432+
`ORG:${contact.organization};\n` +
1433+
`TEL;type=CELL;type=VOICE;waid=${contact.wuid}:${contact.wuid}\n` +
1434+
'END:VCARD';
1435+
1436+
return result;
14421437
};
14431438

14441439
if (data.contactMessage.length === 1) {

0 commit comments

Comments
 (0)