diff --git a/src/message/controllers/inbound.message.controller.ts b/src/message/controllers/inbound.message.controller.ts index a15d059..183ca22 100644 --- a/src/message/controllers/inbound.message.controller.ts +++ b/src/message/controllers/inbound.message.controller.ts @@ -18,6 +18,8 @@ export class MessageController { @Post() async handleIncomingMessageData(@Body() requestData: GSWhatsAppMessage): Promise { - await this.inboundService.handleIncomingGsWhatsappMessage(requestData); + if ("mobile" in requestData){ + await this.inboundService.handleIncomingGsWhatsappMessage(requestData); + } } } diff --git a/src/message/services/outbound/outbound.service.ts b/src/message/services/outbound/outbound.service.ts index 5b6909a..d274363 100644 --- a/src/message/services/outbound/outbound.service.ts +++ b/src/message/services/outbound/outbound.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable, Logger } from '@nestjs/common'; import { convertXMessageToMsg, gupshupWhatsappAdapterServiceConfig } from '@samagra-x/gupshup-whatsapp-adapter'; import { ConfigService } from '@nestjs/config'; import { StylingTag, XMessage } from '@samagra-x/xmessage'; @@ -6,6 +6,7 @@ import { StylingTag, XMessage } from '@samagra-x/xmessage'; @Injectable() export class OutboundService { constructor(private configService: ConfigService) {} + private readonly logger = new Logger(OutboundService.name); async handleOrchestratorResponse(orchestratorRequest: XMessage) { gupshupWhatsappAdapterServiceConfig.setConfig({ @@ -33,8 +34,10 @@ export class OutboundService { if ("text" in orchestratorRequest.payload) { orchestratorRequest.payload.text = orchestratorRequest.payload.text.substring(0,1023) + this.logger.log(orchestratorRequest.payload.text.length) } - await convertXMessageToMsg(orchestratorRequest); + const adapterResponse = await convertXMessageToMsg(orchestratorRequest); + //throw if Not Sent } }