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

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