API callbacks for new data?

Is there a way to get the API to poke my app for new data periodically, possibly using whatever algorithm you use for normal autodata?

Thanks!

2 Likes

An excellent plan. Though I don’t think there’s yet any such thing as ‘normal’ autodata.

@insti and @bee probably have ideas.

1 Like

Not at the moment.
I’d like to see Beeminder implement a feature like this, but it’s not currently high on the priority list.

If it’s your app why can you not just push the data?

2 Likes

I guess what I’m really asking is to get an “autodata” goal with my own
app, so it shows a refresh button in Beeminder that likes my app.

1 Like

You can add a webhook which can call your own app.
But I think it is only triggered when a new datapoint is entered.

Hacky workaround suggestion:
You could trigger it by entering a 0 datapoint, and it would call the webhook which you could then use to get your app to post the latest datapoint or update the zero to whatever the value should be. The Beeminder API is quite flexible and not too hard to use.

Slightly less hacky feature request suggestion:
If a goal has a webhook, allow it to be triggered by the refresh button with a refresh parameter and be configured for an automated daily trigger.

2 Likes

Yeah, this is nothing I need at all… Cron is just fine.

2 Likes

This is really important; thank you so much for bringing it up! I’ve been talking to @bee and @galtsubery about this [1] as well. It’s not enough to push data with a cron job or use other workarounds, for a few reasons:

  1. We want Beeminder’s refresh button to auto-fetch data, as you noted, just like for official integrations
  2. Zeno polling – need new fetch right before sending each new alert on eep days
  3. If you’re down to the wire you don’t want to be derailed by network delays or delays on Beeminder’s end

For #3, for official integrations, Beeminder is smart about this. It knows what time the autodata fetch was scheduled and it counts the data for that exact time even if the deadline has technically passed by the time the data is fetched and the graph processed. This is true even for the final check at exactly the deadline. So if Beeminder can initiate the autodata fetch for 3rd-party integrations then those integrations can have that important feature too.

Beeminder being all about coming down to the wire, that’s more than a nice-to-have. (:


[1] Context: @galtsubery’s brilliant beemind.me discussed here:

2 Likes

I was asking a very similar question (also, whether the refresh button on a goal set to the API data source does anything) and the forum pointed me here before I posted it.

One thing I have to add: Another hack would be to use URLMinder and make the updating app return a page with the appropriate number of words.

1 Like

Ha, that would work! Definitely let me know if anyone resorts to that. We’ll take it as a very strong vote to get proper callbacks for 3rd party integrations deployed!

I took that as a challenge and updated my updater.

https://web-glue.herokuapp.com/wanikani-urlminder

ETA: I did make this work for other people; if anyone uses it they should let me know so I know if I need to keep it around.

1 Like

I am liking being able to hit the refresh button instead of having a refresh button that does nothing and needing to run a script if I want more frequent data than the scheduled thing I had set up. Though my graph is upside down now; it’s a whittle-down and I made the urlminder thing return (starting value - current value)

2 Likes

I’m so happy you made this! Is the WaniKani token the same as the API key in settings?

Also can we send you stickers and give you a discount on premium plans?

(I still really want to make this unnecessary, of course. :))

[quote=“dreev, post:12, topic:1036”]
I’m so happy you made this! Is the WaniKani token the same as the API key in settings?[/quote]

Yes - I’ve fixed the text to reflect the correct terminology now.

Sure!

2 Likes

I’ve run into a small problem. Occasionally my app returns nothing (probably free heroku being slow to start - it’s running on legacy free so I think it will run all the time but it can be really slow) which URLminder treats like an odometer 0. So then after that point, everything is higher than it should be. A spurious 0 would be even worse if it was treated as 0. I guess flakey apps just aren’t a good source of data for URLminder.

The huge jump is noticeable, and luckily things get recalculated correctly when I delete that datapoint.

2 Likes

Ooh, thanks for catching this! Is it potentially a simple matter of URLminder suppressing the adding of any datapoint if it can’t reach the URL it’s minding? Cc @apb.