WifiBiz / src /utils /messages.js
Mbonea's picture
Send SMS when WiFi token expires
8e922fe
/**
* Message templates.
* Keep outbound notification copy here so it stays consistent across channels.
*/
module.exports = {
// Guest receives this after paying for WiFi
wifiCode: (code, planName, duration, deviceName) =>
`WiFi Code: ${code}\nPlan: ${planName} (${duration})\nDevice: ${deviceName}\nEnter this code on the WiFi login page. Valid for ${duration} after connecting.`,
// Guest receives this after a tenant generates a manual token sale
manualWifiCode: (code, planName, duration, deviceName, expiryPreview) =>
`WiFi Code: ${code}\nPlan: ${planName} (${duration})\nDevice: ${deviceName}\nValid for ${duration} after first connection. If used now, access ends around ${expiryPreview}.`,
// Guest receives this when their WiFi token expires
tokenExpired: (deviceName, planName = null) =>
planName
? `Your WiFi access for ${deviceName} (${planName}) has expired. Buy a new bundle to reconnect.`
: `Your WiFi access for ${deviceName} has expired. Buy a new bundle to reconnect.`,
// Tenant receives this after their device subscription renews
deviceRenewal: (deviceName, expiryDate) =>
`"${deviceName}" renewed until ${expiryDate}. Keep selling!`,
// Tenant receives this when their AP comes online for the first time
deviceOnline: (deviceName) =>
`Your device "${deviceName}" is now online! Create WiFi plans to start selling.`,
// Tenant receives this when their AP goes offline
deviceOffline: (deviceName) =>
`Alert: Your device "${deviceName}" went offline. Check the AP.`,
// Tenant receives this when billing expires and device is auto-suspended
deviceSuspended: (deviceName, fee) =>
`Your device "${deviceName}" has been suspended (billing expired). Pay ${fee} TZS to reactivate.`,
// Tenant receives this when they manually pause their device
devicePaused: (deviceName, fee) =>
`Your device "${deviceName}" has been paused. Pay ${fee} TZS to reactivate and resume WiFi service.`,
// Tenant receives this on successful registration
welcome: () =>
`Welcome to WiFi Platform! Add your first device on the dashboard to start selling WiFi.`,
// Tenant receives this 1–3 days before billing expires
billingReminder: (deviceName, daysLeft, fee) =>
`Reminder: Your WiFi device "${deviceName}" expires in ${daysLeft} day(s). Pay ${parseInt(fee).toLocaleString()} TZS to keep it active.`,
// Tenant receives this when requesting a password reset
passwordResetOtp: (otp) => `${otp} is your WifiBiz reset code.`,
// Sent to the NEW phone number to verify ownership during a phone change
phoneChangeOtp: (otp) => `${otp} is your WifiBiz verification code.`,
// Sent to the OLD phone number as a security notice after phone change completes
phoneChangeNotice: (newPhone) =>
`Your WifiBiz account phone number has been changed to ${newPhone}. If this wasn't you, contact support immediately.`,
// Tenant receives this when a payout completes
payoutCompleted: (amount) =>
`Payout of ${parseInt(amount).toLocaleString()} TZS sent to your M-Pesa.`,
// Tenant receives this when a payout fails
payoutFailed: (amount) =>
`Payout of ${parseInt(amount).toLocaleString()} TZS failed. Your balance has been restored.`,
// Tenant sees this in alerts after a guest buys a WiFi bundle
purchaseAlert: (amount, revenue) =>
`New bundle purchase: ${amount}. Revenue after payouts: ${revenue}.`,
// Tenant receives this when admin grants a trial period
trialGranted: (deviceName, days, expiryDate) =>
`Your device "${deviceName}" has been granted a ${days}-day trial. It expires on ${expiryDate}. Good luck!`,
};