mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
fix: use chatwoot with evolution channel
This commit is contained in:
parent
849d5f79dc
commit
25daec9f41
@ -53,7 +53,6 @@
|
|||||||
"@hapi/boom": "^10.0.1",
|
"@hapi/boom": "^10.0.1",
|
||||||
"@prisma/client": "^5.15.0",
|
"@prisma/client": "^5.15.0",
|
||||||
"@sentry/node": "^8.28.0",
|
"@sentry/node": "^8.28.0",
|
||||||
"@sentry/profiling-node": "^8.28.0",
|
|
||||||
"amqplib": "^0.10.3",
|
"amqplib": "^0.10.3",
|
||||||
"axios": "^1.6.5",
|
"axios": "^1.6.5",
|
||||||
"baileys": "6.7.7",
|
"baileys": "6.7.7",
|
||||||
|
@ -306,10 +306,13 @@ export class ChatwootService {
|
|||||||
data = {
|
data = {
|
||||||
inbox_id: inboxId,
|
inbox_id: inboxId,
|
||||||
name: name || phoneNumber,
|
name: name || phoneNumber,
|
||||||
phone_number: `+${phoneNumber}`,
|
|
||||||
identifier: jid,
|
identifier: jid,
|
||||||
avatar_url: avatar_url,
|
avatar_url: avatar_url,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (jid.includes('@')) {
|
||||||
|
data['phone_number'] = `+${phoneNumber}`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
data = {
|
data = {
|
||||||
inbox_id: inboxId,
|
inbox_id: inboxId,
|
||||||
@ -1135,8 +1138,7 @@ export class ChatwootService {
|
|||||||
return { message: 'bot' };
|
return { message: 'bot' };
|
||||||
}
|
}
|
||||||
|
|
||||||
const chatId =
|
const chatId = body.conversation.meta.sender?.identifier;
|
||||||
body.conversation.meta.sender?.phone_number?.replace('+', '') || body.conversation.meta.sender?.identifier;
|
|
||||||
// Chatwoot to Whatsapp
|
// Chatwoot to Whatsapp
|
||||||
const messageReceived = body.content
|
const messageReceived = body.content
|
||||||
? body.content
|
? body.content
|
||||||
@ -1819,14 +1821,12 @@ export class ChatwootService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix when receiving/sending messages from whatsapp desktop with ephemeral messages enabled
|
|
||||||
if (body.message?.ephemeralMessage?.message) {
|
if (body.message?.ephemeralMessage?.message) {
|
||||||
body.message = {
|
body.message = {
|
||||||
...body.message?.ephemeralMessage?.message,
|
...body.message?.ephemeralMessage?.message,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Whatsapp to Chatwoot
|
|
||||||
const originalMessage = await this.getConversationMessage(body.message);
|
const originalMessage = await this.getConversationMessage(body.message);
|
||||||
const bodyMessage = originalMessage
|
const bodyMessage = originalMessage
|
||||||
? originalMessage
|
? originalMessage
|
||||||
|
@ -7,7 +7,6 @@ import { onUnexpectedError } from '@config/error.config';
|
|||||||
import { Logger } from '@config/logger.config';
|
import { Logger } from '@config/logger.config';
|
||||||
import { ROOT_DIR } from '@config/path.config';
|
import { ROOT_DIR } from '@config/path.config';
|
||||||
import * as Sentry from '@sentry/node';
|
import * as Sentry from '@sentry/node';
|
||||||
import { nodeProfilingIntegration } from '@sentry/profiling-node';
|
|
||||||
import { ServerUP } from '@utils/server-up';
|
import { ServerUP } from '@utils/server-up';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import compression from 'compression';
|
import compression from 'compression';
|
||||||
@ -30,7 +29,6 @@ async function bootstrap() {
|
|||||||
dsn: dsn,
|
dsn: dsn,
|
||||||
environment: process.env.NODE_ENV || 'development',
|
environment: process.env.NODE_ENV || 'development',
|
||||||
tracesSampleRate: 1.0,
|
tracesSampleRate: 1.0,
|
||||||
integrations: [nodeProfilingIntegration()],
|
|
||||||
profilesSampleRate: 1.0,
|
profilesSampleRate: 1.0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user