backend/api/timerRouter.js
// notify contact that user has begun a new event
notify contact that user has begun a new event
notify contact that user has begun a new event
function eventStartSMS(user) {
  if (accountSid === "not authorized" || authToken === "not authorized") {
    console.log("contactSMS fire attempt--twilio not authorized");
  } else {
    let contact = user.contacts[0];
    client.messages
      .create({
        body: `${contact.name}, you are receiving this message because ${
          user.username
        } has just embarked on a ${
          user.events.name
        } adventure and selected you as an emergency contact! You may receive more notifications if ${
          user.username
        } misses a checkin with the app or when their adventure is completed, thank you for being their source of support JustNcase!`,
        from: twilioPhone,
        to: contactPhone
      })
      .then(message => {
        console.log(message.sid);
      })
      .done();
  }
}
function eventStartSMS ( user ) { if ( accountSid === "not authorized" || authToken === "not authorized" ) { console . log ( "contactSMS fire attempt--twilio not authorized" ) ; } else { let contact = user . contacts [ 0 ] ; client . messages . create ( { body : ` ${ contact . name } ${ user . username } ${ user . events . name } ${ user . username } ` , from : twilioPhone , to : contactPhone } ) . then ( message => { console . log ( message . sid ) ; } ) . done ( ) ; } }
notify contact that user has begun a new event
notify contact that user has begun a new event
// simulate dynamic contact selections, for demo assume user has already selected this specific contact