repair resend notif wa

This commit is contained in:
2026-01-08 09:35:52 +07:00
parent bc265ccc33
commit 3d163f4507
2 changed files with 6 additions and 7 deletions

View File

@@ -1,10 +1,10 @@
const { default: axios } = require('axios'); const { default: axios } = require('axios');
const CryptoJS = require('crypto-js'); const CryptoJS = require('crypto-js');
const https = require('https'); // const https = require('https');
const httpsAgent = new https.Agent({ // const httpsAgent = new https.Agent({
rejectUnauthorized: false, // rejectUnauthorized: false,
}); // });
const generateTokenRedirect = async (userPhone, userName, id) => { const generateTokenRedirect = async (userPhone, userName, id) => {
@@ -23,7 +23,7 @@ const shortUrltiny = async (encodedToken) => {
const encodedUrl = encodeURIComponent(url); // ⬅️ Encode dulu! const encodedUrl = encodeURIComponent(url); // ⬅️ Encode dulu!
const response = await axios.get(`https://tinyurl.com/api-create.php?url=${encodedUrl}`,{ httpsAgent }); const response = await axios.get(`https://tinyurl.com/api-create.php?url=${encodedUrl}`);
let shortUrl = response.data; let shortUrl = response.data;
if (!shortUrl.startsWith('http')) { if (!shortUrl.startsWith('http')) {
@@ -44,7 +44,7 @@ const sendNotifikasi = async (phone, message) => {
const endPointWhatsapp = process.env.ENDPOINT_WHATSAPP; const endPointWhatsapp = process.env.ENDPOINT_WHATSAPP;
try { try {
const response = await axios.post(endPointWhatsapp, payload, { httpsAgent }); const response = await axios.post(endPointWhatsapp, payload);
// console.log(response.data); // console.log(response.data);
return response?.data return response?.data
} catch (error) { } catch (error) {

View File

@@ -253,7 +253,6 @@ class NotificationService {
}, Gagal: ${results.filter((r) => r.status === "failed").length}` }, Gagal: ${results.filter((r) => r.status === "failed").length}`
); );
} }
} }
module.exports = NotificationService; module.exports = NotificationService;