Skip to content

Commit

Permalink
Merge pull request #13 from samagra-comms/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
KDwevedi authored Dec 5, 2023
2 parents 87e6608 + 739c9bb commit e8915c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/message/controllers/inbound.message.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export class MessageController {

@Post()
async handleIncomingMessageData(@Body() requestData: GSWhatsAppMessage): Promise<any> {
await this.inboundService.handleIncomingGsWhatsappMessage(requestData);
if ("mobile" in requestData){
await this.inboundService.handleIncomingGsWhatsappMessage(requestData);
}
}
}
7 changes: 5 additions & 2 deletions src/message/services/outbound/outbound.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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';

@Injectable()
export class OutboundService {
constructor(private configService: ConfigService) {}
private readonly logger = new Logger(OutboundService.name);

async handleOrchestratorResponse(orchestratorRequest: XMessage) {
gupshupWhatsappAdapterServiceConfig.setConfig({
Expand Down Expand Up @@ -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
}
}

0 comments on commit e8915c8

Please sign in to comment.