Naughty metaminding

UPDATE: I should have tested it more before posting about it. There seem to be some issues with this, which I could try to figure out, or I could just do the proper thing and write a small bridging server that doesn’t attempt to rely on coincidences in the Beeminder API

Beeminder’s Beeminder integration is great, but currently it only supports beeminding the number of data points from another goal. However with my ‘all’ goal I want to beemind the sum of a bunch of other goals.

Because the shape in which data points are exported is conveniently compatible with the shape needed for creating them I figured if I directly wire the data export webhook of, for example, my ‘french’ goal to the API endpoint for creating data points on the ‘all’ goal it should work. Except Beeminder doesn’t allow me to put any Beeminder API except the metaminding endpoint there.

So here comes the naughty bit:

location /beeall {
  proxy_pass https://www.beeminder.com/api/v1/users/ema/goals/all/datapoints.json;
}

I put this in my nginx config and now Beeminder is happily talking to itself mirroring the data points from any goal I point to my nginx to the ‘all’ goal. What could possibly go wrong. (lots of stuff actually so don’t try this at home unless you’re prepared to be very apologetic to the folks at Beeminder in case stuff blows up)

PS
I’ve used make.com before now to do this but I’m getting close to maxing out their 1000 operations a month limit on their free tier so I’ve been looking for a solution that doesn’t involve them.

5 Likes

Couldn’t help myself. Here is how my nginx config looks now

location /beeall {
  set $auth_token $arg_auth_token;
  set $value $arg_value;
  set $source $arg_source;
  set $comment $arg_comment;
  set $args '';
  rewrite ^ /api/v1/users/ema/goals/all/datapoints.json?auth_token=$auth_token&value=$value&comment=$source%20$comment break;
  proxy_pass https://www.beeminder.com;
}

Only passing on the params which I actually want to pass on seems to make it work but I will watch it closely tomorrow. Also putting the source in the comment is a nice feature.

4 Likes