mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 11:42:53 -06:00
fix: Adjustment in the saving of contacts, saving the information of the number and Jid
This commit is contained in:
parent
1b39eb1a23
commit
0dca009c01
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
* Solved problem when disconnecting from the instance the instance was deleted
|
* Solved problem when disconnecting from the instance the instance was deleted
|
||||||
* Encoded spaces in chatwoot webhook
|
* Encoded spaces in chatwoot webhook
|
||||||
|
* Adjustment in the saving of contacts, saving the information of the number and Jid
|
||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
|
@ -205,7 +205,14 @@ export class ChatwootService {
|
|||||||
this.logger.verbose('find contact in chatwoot and create if not exists');
|
this.logger.verbose('find contact in chatwoot and create if not exists');
|
||||||
const contact =
|
const contact =
|
||||||
(await this.findContact(instance, '123456')) ||
|
(await this.findContact(instance, '123456')) ||
|
||||||
((await this.createContact(instance, '123456', inboxId, false, 'EvolutionAPI')) as any);
|
((await this.createContact(
|
||||||
|
instance,
|
||||||
|
'123456',
|
||||||
|
inboxId,
|
||||||
|
false,
|
||||||
|
'EvolutionAPI',
|
||||||
|
'https://evolution-api.com/files/evolution-api-favicon.png',
|
||||||
|
)) as any);
|
||||||
|
|
||||||
if (!contact) {
|
if (!contact) {
|
||||||
this.logger.warn('contact not found');
|
this.logger.warn('contact not found');
|
||||||
@ -269,6 +276,7 @@ export class ChatwootService {
|
|||||||
isGroup: boolean,
|
isGroup: boolean,
|
||||||
name?: string,
|
name?: string,
|
||||||
avatar_url?: string,
|
avatar_url?: string,
|
||||||
|
jid?: string,
|
||||||
) {
|
) {
|
||||||
this.logger.verbose('create contact to instance: ' + instance.instanceName);
|
this.logger.verbose('create contact to instance: ' + instance.instanceName);
|
||||||
|
|
||||||
@ -286,6 +294,7 @@ export class ChatwootService {
|
|||||||
inbox_id: inboxId,
|
inbox_id: inboxId,
|
||||||
name: name || phoneNumber,
|
name: name || phoneNumber,
|
||||||
phone_number: `+${phoneNumber}`,
|
phone_number: `+${phoneNumber}`,
|
||||||
|
identifier: jid,
|
||||||
avatar_url: avatar_url,
|
avatar_url: avatar_url,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -437,6 +446,7 @@ export class ChatwootService {
|
|||||||
false,
|
false,
|
||||||
body.pushName,
|
body.pushName,
|
||||||
picture_url.profilePictureUrl || null,
|
picture_url.profilePictureUrl || null,
|
||||||
|
body.key.participant,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -452,6 +462,7 @@ export class ChatwootService {
|
|||||||
if (findContact) {
|
if (findContact) {
|
||||||
contact = findContact;
|
contact = findContact;
|
||||||
} else {
|
} else {
|
||||||
|
const jid = isGroup ? null : body.key.remoteJid;
|
||||||
contact = await this.createContact(
|
contact = await this.createContact(
|
||||||
instance,
|
instance,
|
||||||
chatId,
|
chatId,
|
||||||
@ -459,6 +470,7 @@ export class ChatwootService {
|
|||||||
isGroup,
|
isGroup,
|
||||||
nameContact,
|
nameContact,
|
||||||
picture_url.profilePictureUrl || null,
|
picture_url.profilePictureUrl || null,
|
||||||
|
jid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -472,6 +484,7 @@ export class ChatwootService {
|
|||||||
contact = findContact;
|
contact = findContact;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const jid = isGroup ? null : body.key.remoteJid;
|
||||||
contact = await this.createContact(
|
contact = await this.createContact(
|
||||||
instance,
|
instance,
|
||||||
chatId,
|
chatId,
|
||||||
@ -479,6 +492,7 @@ export class ChatwootService {
|
|||||||
isGroup,
|
isGroup,
|
||||||
nameContact,
|
nameContact,
|
||||||
picture_url.profilePictureUrl || null,
|
picture_url.profilePictureUrl || null,
|
||||||
|
jid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user