async function sendOtp(to) {
const baseUrl = process.env.KARFLOWS_BASE_URL || "https://karflows.com";
const res = await fetch(`${baseUrl}/api/omni/otp/send`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KARFLOWS_UNIFIED_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ to, channels: ["whatsapp_qr", "sms"] }),
});
return res.json();
}
async function verifyOtp(pinId, pin) {
const baseUrl = process.env.KARFLOWS_BASE_URL || "https://karflows.com";
const res = await fetch(`${baseUrl}/api/omni/otp/verify`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KARFLOWS_UNIFIED_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ pinId, pin }),
});
return res.json();
}