Duffer Derek
import axios from "axios";
import Log from "../configs/logger.js";
export const sendSms = async (phone, otp) => {
try {
const url = `${process.env.SMS_API_URL}?apikey=${process.env.SMS_API_KEY}`;
const data = {
messages: [
{
to: phone, // e.g. "20114005"
countryHint: process.env.COUNTRY_CODE || "45",
text: `${otp} is your verification code for task.malerkanonen.dk`,
from: "MALERKANONEN"
}
]
};
const urlForLog = url.replace(/([?&]apikey=)[^&]*/i, "$1[redacted]");
Log.info("SMS request", { url: urlForLog, data });
const response = await axios.post(url, data, {
headers: {
"Content-Type": "application/json"
}
});
return response.data;
} catch (error) {
Log.error("SMS Error:", error.response?.data || error.message);
throw error;
}
};
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists