ajustes wa business

This commit is contained in:
Davidson Gomes 2024-04-03 08:14:56 -03:00
parent aa5ed13752
commit f11d468e31
2 changed files with 31 additions and 3 deletions

View File

@ -5,6 +5,7 @@
* Correction when sending files with captions on Whatsapp Business
* Correction in receiving messages with response on WhatsApp Business
* Correction when sending a reaction to a message on WhatsApp Business
* Correction of receiving reactions on WhatsApp business
* Removed mandatory description of rows from sendList
* Feature to collect message type in typebot

View File

@ -194,6 +194,20 @@ export class BusinessStartupService extends WAStartupService {
return content;
}
private messageReactionJson(received: any) {
const message = received.messages[0];
let content: any = {
reactionMessage: {
key: {
id: message.reaction.message_id,
},
text: message.reaction.emoji,
},
};
message.context ? (content = { ...content, contextInfo: { stanzaId: message.context.id } }) : content;
return content;
}
private messageTextJson(received: any) {
let content: any;
const message = received.messages[0];
@ -344,6 +358,18 @@ export class BusinessStartupService extends WAStartupService {
owner: this.instance.name,
// source: getDevice(received.key.id),
};
} else if (received?.messages[0].reaction) {
messageRaw = {
key,
pushName,
message: {
...this.messageReactionJson(received),
},
messageType: 'reactionMessage',
messageTimestamp: received.messages[0].timestamp as number,
owner: this.instance.name,
// source: getDevice(received.key.id),
};
} else if (received?.messages[0].contacts) {
messageRaw = {
key,
@ -1205,6 +1231,10 @@ export class BusinessStartupService extends WAStartupService {
}
}
public async deleteMessage() {
throw new BadRequestException('Method not available on WhatsApp Business API');
}
// methods not available on WhatsApp Business API
public async mediaSticker() {
throw new BadRequestException('Method not available on WhatsApp Business API');
@ -1227,9 +1257,6 @@ export class BusinessStartupService extends WAStartupService {
public async archiveChat() {
throw new BadRequestException('Method not available on WhatsApp Business API');
}
public async deleteMessage() {
throw new BadRequestException('Method not available on WhatsApp Business API');
}
public async fetchProfile() {
throw new BadRequestException('Method not available on WhatsApp Business API');
}