From 99a091ec613ed8943cbd493566c339b8bb2878b3 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Fri, 12 Jul 2024 12:55:16 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20Corre=C3=A7=C3=A3o=20no=20retorno=20dos?= =?UTF-8?q?=20envios=20na=20API=20oficial=20do=20WhatsApp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correção no serviço WhatsApp Business para retornar a mensagem após o envio. Além disso, foi adicionada a capacidade de deletar templates por ID. Arquivos modificados: - whatsapp.business.service.ts - template.service.ts --- src/api/services/channels/whatsapp.business.service.ts | 2 ++ src/api/services/template.service.ts | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/services/channels/whatsapp.business.service.ts b/src/api/services/channels/whatsapp.business.service.ts index 2ff8caf0e..f0343ee9f 100644 --- a/src/api/services/channels/whatsapp.business.service.ts +++ b/src/api/services/channels/whatsapp.business.service.ts @@ -602,6 +602,8 @@ export class BusinessStartupService extends ChannelStartupService { documentMessage: message, }; } + + return message; } protected async eventHandler(content: any) { diff --git a/src/api/services/template.service.ts b/src/api/services/template.service.ts index 13a436f35..f5c73f527 100644 --- a/src/api/services/template.service.ts +++ b/src/api/services/template.service.ts @@ -36,8 +36,6 @@ export class TemplateService { throw new Error('Error to create template'); } - console.log(response); - return response.data; } @@ -66,8 +64,6 @@ export class TemplateService { throw new Error('Error to create template'); } - console.log(response); - const template = await this.prismaRepository.template.create({ data: { instanceId: getInstance.id, @@ -96,6 +92,9 @@ export class TemplateService { } else if (method === 'POST') { const result = await axios.post(urlServer, data, { headers }); return result.data; + } else if (method === 'DELETE') { + const result = await axios.delete(urlServer + '/' + data, { headers }); + return result.data; } } catch (e) { this.logger.error(e.response.data);