fix: Adjusts the quoted message, now has contextInfo in the message Raw

This commit is contained in:
Davidson Gomes 2024-01-02 13:49:31 -03:00
parent 380ba8860c
commit 306c6dd21d
3 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@
* When possible use the original file extension
* When receiving a file from whatsapp, use the original filename in chatwoot if possible
* Remove message ids cache in chatwoot to use chatwoot's api itself
* Adjusts the quoted message, now has contextInfo in the message Raw
# 1.6.1 (2023-12-22 11:43)

View File

@ -29,6 +29,7 @@ export class MessageRaw {
source_id?: string;
source_reply_id?: string;
chatwoot?: ChatwootMessage;
contextInfo?: any;
}
const messageSchema = new Schema<MessageRaw>({

View File

@ -1029,6 +1029,8 @@ export class WAStartupService {
const localUrl = this.localWebhook.url;
console.log(data);
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
const logData = {
local: WAStartupService.name + '.sendDataWebhook-global',
@ -1756,6 +1758,8 @@ export class WAStartupService {
received?.message?.documentMessage ||
received?.message?.audioMessage;
const contentMsg = received.message[getContentType(received.message)] as any;
if (this.localWebhook.webhook_base64 === true && isMedia) {
const buffer = await downloadMediaMessage(
{ key: received.key, message: received?.message },
@ -1773,6 +1777,7 @@ export class WAStartupService {
...received.message,
base64: buffer ? buffer.toString('base64') : undefined,
},
contextInfo: contentMsg?.contextInfo,
messageType: getContentType(received.message),
messageTimestamp: received.messageTimestamp as number,
owner: this.instance.name,
@ -1783,6 +1788,7 @@ export class WAStartupService {
key: received.key,
pushName: received.pushName,
message: { ...received.message },
contextInfo: contentMsg?.contextInfo,
messageType: getContentType(received.message),
messageTimestamp: received.messageTimestamp as number,
owner: this.instance.name,