Skip to content

Commit

Permalink
feat: send to multiple SMS numbers separated by comma (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism authored Feb 26, 2025
1 parent 0f5dcab commit 7766780
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/helpers/notifme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,16 @@ export const sendNotification = async (message: string) => {
if (channels.sms) {
console.log("Sending SMS");
try {
await notifier.send({
sms: {
from: getSecret("NOTIFICATION_SMS_FROM") as string,
to: getSecret("NOTIFICATION_SMS_TO") as string,
text: message,
},
});
const phoneNumbers = getSecret("NOTIFICATION_SMS_TO")?.split(",") ?? [];
for (const phoneNumber of phoneNumbers) {
await notifier.send({
sms: {
from: getSecret("NOTIFICATION_SMS_FROM") as string,
to: phoneNumber,
text: message,
},
});
}
console.log("Success SMS");
} catch (error) {
console.log("Got an error", error);
Expand Down

0 comments on commit 7766780

Please sign in to comment.