Compare commits
No commits in common. "bef9f99f1320418993818217c9f6c4e98d1fc842" and "8e0c8462b9d06afcca06fd946f822eae1fb36a7d" have entirely different histories.
bef9f99f13
...
8e0c8462b9
|
@ -12,7 +12,6 @@ import {
|
||||||
} from './whatsapp.constant';
|
} from './whatsapp.constant';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { Logger } from '@nestjs/common';
|
import { Logger } from '@nestjs/common';
|
||||||
import { apm } from 'src/core/apm';
|
|
||||||
|
|
||||||
export class WhatsappService {
|
export class WhatsappService {
|
||||||
async sendMessage(data) {
|
async sendMessage(data) {
|
||||||
|
@ -26,14 +25,8 @@ export class WhatsappService {
|
||||||
data: data,
|
data: data,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios(config);
|
const response = await axios(config);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
|
||||||
Logger.error(error);
|
|
||||||
apm?.captureError(error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async queueRegister(data: WhatsappQueue) {
|
async queueRegister(data: WhatsappQueue) {
|
||||||
|
@ -98,11 +91,8 @@ export class WhatsappService {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await this.sendMessage(payload);
|
await this.sendMessage(payload);
|
||||||
if (response)
|
Logger.log(`Notification register for ${data.code} send to ${data.phone}`);
|
||||||
Logger.log(
|
|
||||||
`Notification register for ${data.code} send to ${data.phone}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async queueProcess(data: WhatsappQueue) {
|
async queueProcess(data: WhatsappQueue) {
|
||||||
|
@ -162,8 +152,7 @@ export class WhatsappService {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await this.sendMessage(payload);
|
await this.sendMessage(payload);
|
||||||
if (response)
|
|
||||||
Logger.log(`Notification process for ${data.code} send to ${data.phone}`);
|
Logger.log(`Notification process for ${data.code} send to ${data.phone}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue