Merge pull request #228 from raimartinsb/develop

fix messages not received: error handling when updating contact
This commit is contained in:
Davidson Gomes 2023-11-29 08:45:24 -03:00 committed by GitHub
commit e02a28f61e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,14 +338,18 @@ export class ChatwootService {
}
this.logger.verbose('update contact in chatwoot');
const contact = await client.contacts.update({
accountId: this.provider.account_id,
id,
data,
});
try {
const contact = await client.contacts.update({
accountId: this.provider.account_id,
id,
data,
});
this.logger.verbose('contact updated');
return contact;
this.logger.verbose('contact updated');
return contact;
} catch (error) {
this.logger.error(error);
}
}
public async findContact(instance: InstanceDto, phoneNumber: string) {
@ -488,6 +492,9 @@ export class ChatwootService {
avatar_url: picture_url.profilePictureUrl || null,
});
}
if (!contact) {
contact = await this.findContact(instance, chatId);
}
} else {
const jid = isGroup ? null : body.key.remoteJid;
contact = await this.createContact(