Review integration with official WhatsApp API

This commit is contained in:
Davidson Gomes
2024-06-09 14:18:19 -03:00
parent 585bf84af4
commit 9e25904dc9
8 changed files with 127 additions and 79 deletions

View File

@@ -721,6 +721,8 @@ export class ChatwootService {
const sourceReplyId = quotedMsg?.chatwootMessageId || null;
console.log('sourceReplyId', sourceReplyId);
const message = await client.messages.create({
accountId: this.provider.accountId,
conversationId: conversationId,
@@ -1734,6 +1736,8 @@ export class ChatwootService {
const quotedId = body.contextInfo?.stanzaId || body.message?.contextInfo?.stanzaId;
console.log('quotedId', quotedId);
let quotedMsg = null;
if (quotedId)
@@ -1746,6 +1750,8 @@ export class ChatwootService {
},
});
console.log('quotedMsg', quotedMsg);
const isMedia = this.isMediaMessage(body.message);
const adsMessage = this.getAdsMessage(body.message);
@@ -1968,8 +1974,6 @@ export class ChatwootService {
if (event === Events.MESSAGES_DELETE) {
const chatwootDelete = this.configService.get<Chatwoot>('CHATWOOT').MESSAGE_DELETE;
console.log('chatwootDelete', chatwootDelete);
if (chatwootDelete === true) {
if (!body?.key?.id) {
this.logger.warn('message id not found');
@@ -1977,7 +1981,6 @@ export class ChatwootService {
}
const message = await this.getMessageByKeyId(instance, body.key.id);
console.log('message', message);
if (message?.chatwootMessageId && message?.chatwootConversationId) {
await this.prismaRepository.message.deleteMany({

View File

@@ -935,7 +935,7 @@ export class TypebotService {
formattedText = formattedText.replace(/\n$/, '');
await instance.textMessage(
await instance.textMessage(
{
number: remoteJid.split('@')[0],
delay: settings?.delayMessage || 1000,