greglgomez at April 22nd, 2015 11:02 — #1
I'm interested in the Quantified Self movement and would like to explore using Webhook to display data from health and fitness tracker APIs.
Lets say I have a "Run" content type where I would like to display stats from my latest RunKeeper activity.
Question 1: Is there a way to automate the import of JSON from an external API?
I've had a look at the documentation for Importing Custom Data, but it doesn't really mention anything about automation.
One theory I have is that I could create a local Grunt task that fetches the latest data from the RunKeeper API and creates a JSON file that another task can then ingest into Firebase.
Question 2: is this possible or even the best way about it?
Any guidance you folks can provide on my quest would be much appreciated.
dkenzik at April 22nd, 2015 19:59 — #2
What I would do, which is very similar to what I'm working on now, is to write a node.js app that polls the external API at a specific interval (or on-demand), and push those changes directly to your Firebase content-type. You can forever the node process on a free/cheap VPS server somewhere and you are good to go.
Your grunt idea is doable, too. Webhook's local runserver is grunt-based, but it seems like it does the opposite -- it listens to Firebase for 'something' (content update from the CMS via FB, signal to create a new site via FB, etc.) and then kicks off the respective set of tasks locally.
greglgomez at April 23rd, 2015 17:26 — #3
@dkenzik, Thanks for the reply.
Do you have any open source code you could share regarding your node.js app to poll API's?
If not, can you suggest some useful modules that will help me achieve this?
A question does emerge from your method: would it be possible to trigger Webhook builds when Firebase content is updated via an external app?
dkenzik at April 23rd, 2015 18:39 — #4
I have nothing open-source yet regarding the polling of external services, but I will when I reach a publishable iteration. I'm using the
request module to wire things up for now, but that may change before I publish. There are other modules out there, but they all do the same for the most part.
I do have an open-source Webhook content API (WIP), in case it will help with some other aspect of your project. I'm using it in an SPA I'm developing, which relies on Webhook as just the CMS. I have a few todo's left on it before it's usable for the general public, such as non-specific relationship walking and modularization, but it's out there.
As far as triggering Webhook builds, my plan is to use the Webhook beta API, in particular their build endpoint. I may even choose to use their insert and update endpoints, instead of updating my Firebase directly, since those are already maintained by the Webhook team and has some inferred controls regarding the data structure.
Hope that helps.
greglgomez at April 23rd, 2015 20:15 — #5
Yes, this sounds like the most extensible and less error prone solution. Either way I'll be digging into the problem in the next few days, and share any findings.
I might bug you with a question or two if you don't mind?
davesnider at April 23rd, 2015 21:50 — #6
You might really like https://gyrosco.pe/ . It's built by an old colleague
greglgomez at April 24th, 2015 03:27 — #7
Yes Dave, I'm very aware of Anand's work! AprilZero.com made me question the whole premise of my final year university project I'm working on at the moment! Whilst I simply cannot fault his implementation and attention to detail, I'd much rather stay open source.
I really like the beta for Gyroscope so far, but if I can pull off what I want in Webhook, it means every one else can benefit from it, and hopefully contribute to it with new ways to view data or even implementing new data sources.
All in all, I'm really excited to be working with Webhook, it's a really nice platform and can't wait to share my work with you all!
davesnider at April 24th, 2015 03:48 — #8
Good luck. Yell at us if you run into trouble along the way.
himanshu at November 10th, 2017 03:49 — #9
Their are many source to make fun in your boring time but here on our homepage on just single click here wertyuiop you will play many free online trending games and watch free online videos here on our homepage it is one of the best online fun and game zone you must have to visit here our homepage it is really awesome.