An endpoint to display whether Nate is alive or not
To check-in, I added a link to my phone's homescreen that hits a Torpio webhook. This webhook updates Firebase, a real-time NoSQL cloud database, via Zapier, a sort of API for APIs.
Check-in: Link → Torpio → Zapier → Firebase
Pull date: Website ← Firebase
- Torpio webhook - when visited, parses todays date and send it to a Zapier webhook
- Zapier webhook - when visited, updates a record in firebase with the date parameter passed to it
- Firebase - Stores a single entry with a date field
- Website - when visited, pulls record from Firebase and sets the date on the page
var firebase = new Firebase(FIREBASE_URL)
firebase.on('child_added', function(snapshot) {
var checkin = snapshot.val()
document.getElementById('date').innerHTML = checkin.date
})
var date = new Date().toLocaleTimeString('en-us', {
hour: '2-digit',
minute: '2-digit',
weekday: 'short',
year: 'numeric',
month: 'short',
day: 'numeric',
hour12: true
})
, zapierWebhook = 'https://zapier.com/hooks/catch/ow7wcu/?date='
if (datetime) http.get(zapierWebhook + date, function(error, response, body) {
log.info(error, response, body, date)
})