Sends realtime text messages to your phone whenever a new mentor question comes up.
- Configure a programmable sms service from twilio
- Have your twilio account send sms POST requests to your backend using /sms
- Add your twilio sid and token to server.js
- Change the baseURL inside index.js to your backend
- Log into helpdesk.lahacks.com
- Have a deployed backend
- Run the top script of index.js in the console of your web browser.
- in Google Chrome: right-click -> inspect -> console tab
- Open https://helpdesk.lahacks.com/api/ticket/open in a new tab.
- Run the bottom script of index.js in the bottom console of your web browser.
The top script of index.js clicks on the refresh button so that you can keep the authToken from lahacks.com refreshed. The bottom script of index.js converts the JSON from the lahacks api to base64 and sends it to your backend by adding it into the URL The backend then checks to see if it has seen it already or not and sends the new message accordingly. Both index.js scripts runs every minute.
Originally I wanted to send a post request with all the json to my backend but LAHacks cors prevents post requests. Sometimes the LAHacks api would time out my auth token and I would recent unauthorized user. I solved this by just creating something that would click the refresh button to refresh the login token.