add log in resend notif wa

This commit is contained in:
2026-01-08 11:30:41 +07:00
parent a6075174f5
commit a4d8d55dbf
2 changed files with 16 additions and 9 deletions

View File

@@ -186,7 +186,7 @@ class NotificationService {
if (activeUsers.length < 1)
throw new ErrorHandler(404, "No active contacts");
this._executeResendInBackground(
this._executeResendWa(
id,
activeUsers,
deviceNotification,
@@ -198,23 +198,27 @@ class NotificationService {
};
}
static async _executeResendInBackground(
static async _executeResendWa(
id,
activeUsers,
deviceNotification,
errorCode
) {
console.log(`process untuk ID: ${id}`);
console.log(`user active: `, id, activeUsers);
const sendPromises = activeUsers.map(async (user) => {
try {
console.log(`user: ${user.contact_name} (${user.contact_phone})`);
const tokenRedirect = await generateTokenRedirect(
user.contact_phone,
user.contact_name,
id
);
const encodedToken = encodeURIComponent(tokenRedirect);
console.log("token: ", tokenRedirect);
const shortUrl = await shortUrltiny(encodedToken);
console.log("URL:", shortUrl);
const bodyWithUrl =
`Hai ${user.contact_name || "-"}\n` +
@@ -227,6 +231,8 @@ class NotificationService {
user.contact_phone,
bodyWithUrl
);
console.log("notifikasi wa:", resultSend)
const isSuccess = resultSend?.error ? false : true;
@@ -247,6 +253,7 @@ class NotificationService {
});
const results = await Promise.all(sendPromises);
console.log("result akhir: ", results)
console.log(
`Resend chat: ${