Feature request: autodata from an API

There is an IFTTT autodata integration, which I could probably use to get the equivalent of what I’m asking for. But there is no intrinsic reason this should have to go through IFTTT.

I have a personal webserver, on which I can expose an API endpoint which returns a number. I’d like a way to have Beeminder set up to use that as an autodata source, much like, say, the IFTTT autodata source.

For now, I’m using the Beeminder API to send data to Beeminder, in a cron job. But there some goals where I’d really prefer the autodata model, which has a few advantages, mostly revolving around the fact that Beeminder is pulling the data, instead of me having to push it.

First and foremost among these advantages is that Beeminder has some very smart behavior around derailments on goals with autodata sources: if a derailment is about to happen, it first polls the autodata source to get the up-to-date data from that source, to verify the derailment.

For goals which are specific actions this is less useful, and I can just use the API. Every time I do X, I send a datapoint (or a script sends a datapoint for me.) I have several goals that work like this. But for “continuous” goals, anything which is the number of something that I have (the kind of thing you use a whittle down or odometer goal for, actually), this is a lot harder. You can kind of simulate it with a cron job that every hour sends the updated value to Beeminder, but that has several problems: for one, if you look at the Beeminder graph, you see data that is up to an hour old. For another, if the goal is about to derail and you accomplish enough to avoid the derailment within the last hour, the data won’t necessarily get to Beeminder in time.

(You could mostly avoid this by having the data be sent to Beeminder more frequently, such as every minute instead of every hour, but that would put Beeminder’s servers under a lot of load, and I wouldn’t want to do that. (Plus, I think there is a limit on the number of datapoints per day that Beeminder will store.))

So it would be very nice to have an autodata integration that allowed you to input a URL on your own domain of your choice (e.g. https://my-domain.com/my-goal) which response to GET requests with a number, and this would feed into a whittle down or odometer goal in the same way that any other autodata would work.

Again, in theory it’s possible I could set up IFTTT to do this. But that might actually be quite difficult (or impossible), because I don’t see a way to get IFTTT to pass through requests in order to always get an up to date result even in cases like the request that gets made right before a derailment. If someone does have a clever way to do this with IFTTT, I’d be interested to hear it.

But all the more I’d really like it if Beeminder supported this natively. It would enable so much when it comes to personal automation.

3 Likes

If you set up your own autodata in the settings, Beeminder will do a POST with the username and slug, will follow the autodata schedule, and when you click refresh on the goal, it’ll pull new data in. It’s not quite EXACTLY what you asking for, but it might be close enough.

If you go to https://www.beeminder.com/settings/account#account-permissions, Create an App, and then assign a goal to that, it’ll all go together. I usually tie the autodata to the goal using curl, with something like curl -X PUT [https://www.beeminder.com/api/v1/users/USER/goals/GOALNAME](https://www.beeminder.com/api/v1/users/USER/goals/GOALNAME) -d auth_token=REDACTED -d datasource=AUTODATANAME.

4 Likes

Oh, that’s quite cool. I didn’t know you could do that!

It seems that for all intents and purposes it is what I wanted, if not exactly literally what I was asking for. If I had know that existed, I wouldn’t have even made this forum post.

So thanks! You’ve shown me an awesome new tool I can use to make my personal Beeminder integrations even better.

1 Like

Curious: This looks a little bit complicated to set up. Why not have some simple web hook settings on a per-goal basis, so the user could supply an arbitrary URL and optionally basic auth or similar, without having to register an App or use the command line to complete the configuration?

1 Like

I suspect the reason why the integration is the way it is is that it’s what Beeminder needs if folks setup OAuth2 in their integrations. OAuth2 is a pretty great way for webservices to talk to each other when there is user authentication on the line.

2 Likes

It sounds like you’re describing one of Beeminder’s first 500 UVIs from 2012 – adding a callback URL that Beeminder will post data to in real time. We call it “webhook for realtime PESOS” in goal settings:

image

Beeminder’s super serious about not holding your data hostage! :slight_smile:

1 Like

That’s great! But I was wondering why you don’t have the reverse–a web hook url field that Beeminder uses to get data instead of posting data to it.

2 Likes

Oh! Dang, yeah, that would be amazing…

1 Like