Compare commits

..

No commits in common. "bef9f99f1320418993818217c9f6c4e98d1fc842" and "8e0c8462b9d06afcca06fd946f822eae1fb36a7d" have entirely different histories.

1 changed files with 6 additions and 17 deletions

View File

@ -12,7 +12,6 @@ import {
} from './whatsapp.constant';
import axios from 'axios';
import { Logger } from '@nestjs/common';
import { apm } from 'src/core/apm';
export class WhatsappService {
async sendMessage(data) {
@ -26,14 +25,8 @@ export class WhatsappService {
data: data,
};
try {
const response = await axios(config);
return response.data;
} catch (error) {
Logger.error(error);
apm?.captureError(error);
return null;
}
const response = await axios(config);
return response.data;
}
async queueRegister(data: WhatsappQueue) {
@ -98,11 +91,8 @@ export class WhatsappService {
},
};
const response = await this.sendMessage(payload);
if (response)
Logger.log(
`Notification register for ${data.code} send to ${data.phone}`,
);
await this.sendMessage(payload);
Logger.log(`Notification register for ${data.code} send to ${data.phone}`);
}
async queueProcess(data: WhatsappQueue) {
@ -162,8 +152,7 @@ export class WhatsappService {
},
};
const response = await this.sendMessage(payload);
if (response)
Logger.log(`Notification process for ${data.code} send to ${data.phone}`);
await this.sendMessage(payload);
Logger.log(`Notification process for ${data.code} send to ${data.phone}`);
}
}