mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 18:08:40 -06:00
feat(chatwoot): send private message on error message sent from chatwoot
This commit is contained in:
parent
84ad8e0d6e
commit
96fdb210be
@ -1119,7 +1119,7 @@ export class ChatwootService {
|
|||||||
conversationId: conversation,
|
conversationId: conversation,
|
||||||
data: {
|
data: {
|
||||||
content: i18next.t('cw.message.notsent', {
|
content: i18next.t('cw.message.notsent', {
|
||||||
error: error.length > 0 ? `_${error}_` : '',
|
error: error?.length > 0 ? `_${error}_` : '',
|
||||||
}),
|
}),
|
||||||
message_type: 'outgoing',
|
message_type: 'outgoing',
|
||||||
private: true,
|
private: true,
|
||||||
@ -1295,6 +1295,11 @@ export class ChatwootService {
|
|||||||
return { message: 'bot' };
|
return { message: 'bot' };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!waInstance && body.conversation?.id) {
|
||||||
|
this.onSendMessageError(instance, body.conversation?.id, 'Instance not found');
|
||||||
|
return { message: 'bot' };
|
||||||
|
}
|
||||||
|
|
||||||
this.logger.verbose('Format message to send');
|
this.logger.verbose('Format message to send');
|
||||||
let formatText: string;
|
let formatText: string;
|
||||||
if (senderName === null || senderName === undefined) {
|
if (senderName === null || senderName === undefined) {
|
||||||
@ -1370,6 +1375,9 @@ export class ChatwootService {
|
|||||||
let messageSent: MessageRaw | proto.WebMessageInfo;
|
let messageSent: MessageRaw | proto.WebMessageInfo;
|
||||||
try {
|
try {
|
||||||
messageSent = await waInstance?.textMessage(data, true);
|
messageSent = await waInstance?.textMessage(data, true);
|
||||||
|
if (!messageSent) {
|
||||||
|
throw new Error('Message not sent');
|
||||||
|
}
|
||||||
|
|
||||||
this.updateChatwootMessageId(
|
this.updateChatwootMessageId(
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user