Skip to content

Easily enable an application to instantly notify developers of critical errors via SMS messages.

License

Notifications You must be signed in to change notification settings

401-Team-Awesome/sos-sms-server

Repository files navigation

SOS-SMS

Node.js Version

Contributors: Sarah Bixler, Cara Ottmar, Zachary Schumpert, Carl Olson

This application allows a user to easily send a text message containing an error number and error message from any where in their code. To do so the user must first install the sossms npm package, which will enable them to use our function.

A Twilio account is required to utilize the sossms sms messaging capability. The user must provide a twilio phone number, where the error message will be texted from and also input a phone number that the error message will be texted to.

Create an Account

In order to use our npm package, the user must first have an account id to reference and pass in to the function provided in the package

  • Make a POST request to our api/accounts route. This route takes an opt user name and a required phone number.
  • Example Request:
https://sos-sms.herokuapp.com/api/accounts?userPhoneNumber=12223334444__?password=secret?username=vinicio?email=gregor@gregor.com

Once an account has been posted, the id from that account is accessible in the return as the _id property on the response object.

The _id can then be passed into the sossms function, as an argument to the userID parameter.

Doing so enables the message schema to be attached to the Account Schema in a one to many relationship where the Account is the one and the Message is the many.

Accounts will be able to have many messages, but each message can only be attached to one account.

References to the messages are stored under the Account.messages property.

the _id of the Account holding a message can be accessed from a message instance via the messages account property. Example: message.account

Install the npm package

  • npm i sos-sms
  • require the package into your file
  • the function signature is: (error, userID, message)

The function signature takes in an error code (which is a string), a user id (a number) and a message (a string) that the user can define or pass in to describe the error.

This function can be invoked anywhere in your code.

Send an SMS Message!

Simply invoke the function any where in your code with the required arguments and it will send a post request to our API. The POST request to our API logs a message to our MongoDB messages database and sends an SMS containing the message and error code via Twilio.

License

MIT

About

Easily enable an application to instantly notify developers of critical errors via SMS messages.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •