Skip to content

Commit

Permalink
Update script.js to fix url
Browse files Browse the repository at this point in the history
  • Loading branch information
moshethebeadle authored Jun 13, 2024
1 parent 15f71b6 commit b733c19
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ sendSMSLink.addEventListener('click', () => {

const message = messageInput.value;


// example:
// <a href="sms://open?addresses=+12223334444,+12223334445?&body=Message%20Line%201%E2%80%A8Message%20Line%202">Send SMS to multi #s</a>
// vs
// sms:/open?addresses={phone number 1},{phone number 2},...

// https://stackoverflow.com/a/71807194

// Construct the SMS link
const smsLink = `sms:${phoneNumbers.join(';')}&body=${encodeURIComponent(message)}`;
const smsLink = `sms://open?addresses=${phoneNumbers.map(n => "+1" + n).join(',')}?&body=${encodeURIComponent(message)}`;

logStatus(`SMS link: ${smsLink}`);

Expand Down

0 comments on commit b733c19

Please sign in to comment.