Skip to content

Commit

Permalink
fix: Correção no retorno dos envios na API oficial do WhatsApp
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dgcode-tec committed Jul 12, 2024
1 parent 26bddf3 commit 99a091e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/api/services/channels/whatsapp.business.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ export class BusinessStartupService extends ChannelStartupService {
documentMessage: message,
};
}

return message;
}

protected async eventHandler(content: any) {
Expand Down
7 changes: 3 additions & 4 deletions src/api/services/template.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export class TemplateService {
throw new Error('Error to create template');
}

console.log(response);

return response.data;
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 99a091e

Please sign in to comment.