test: contacts update

This commit is contained in:
Davidson Gomes 2023-07-18 11:25:34 -03:00
parent 819ed168da
commit c1226062b1

View File

@ -1444,29 +1444,29 @@ export class ChatwootService {
} }
} }
if (event === 'contacts.update') { // if (event === 'contacts.update') {
this.logger.verbose('event contacts.update'); // this.logger.verbose('event contacts.update');
const data = body; // const data = body;
if (data.length) { // if (data.length) {
this.logger.verbose('contacts found'); // this.logger.verbose('contacts found');
for (const item of data) { // for (const item of data) {
const number = item.id.split('@')[0]; // const number = item.id.split('@')[0];
const photo = item.profilePictureUrl || null; // const photo = item.profilePictureUrl || null;
this.logger.verbose('find contact in chatwoot'); // this.logger.verbose('find contact in chatwoot');
const find = await this.findContact(instance, number); // const find = await this.findContact(instance, number);
if (find) { // if (find) {
this.logger.verbose('contact found'); // this.logger.verbose('contact found');
this.logger.verbose('update contact in chatwoot'); // this.logger.verbose('update contact in chatwoot');
await this.updateContact(instance, find.id, { // await this.updateContact(instance, find.id, {
avatar_url: photo, // avatar_url: photo,
}); // });
} // }
} // }
} // }
} // }
if (event === 'qrcode.updated') { if (event === 'qrcode.updated') {
this.logger.verbose('event qrcode.updated'); this.logger.verbose('event qrcode.updated');