From Jeff Sasse, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from Jeff Sasse
- go back
Embed
Viewing differences between Untitled and Re: Untitled
function testSms() {
var SW_PHONE = '14231212121';            //
var SW_TO = '14233434343';               //
var SW_MSG = 'Test SMS on Signalwire';   //
var SW_IMG = '';                         //
                                         //
var SW_SPACE = 'https://ezrds.'https://epdsa.signalwire.com/api/relay/rest/';                        //
var SW_PROJ = '869728dc-0123-4567-8901-234567890123';
var SW_TOKEN = 'abcdefghijklmnopqrstuvwxyz';                       //

  try {
    var status = UrlFetchApp.fetch(SW_SPACE, {
      method: 'post',
      headers: { Authorization: 'Basic ' + Utilities.base64Encode(SW_PROJ + ":" + SW_TOKEN)},
      payload: {
        To: SW_TO.toString(),
        From: SW_PHONE,
        Body: SW_MSG,
      },
    });
    return 'sent: ' + new Date();
  }
  catch (err) {
    return 'error: ' + err;
  }
  Browser.msgBox(status);
}