add log in resend notif wa
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user