# API callbacks for new data?

**URL:** <https://forum.beeminder.com/t/api-callbacks-for-new-data/1036>\
**Category:** Bugabee\
**Created:** [August 8, 2015, 4:29pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036 "2015-08-08T16:29:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamwolf](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/adamwolf/32/484_2.png) [@adamwolf](https://forum.beeminder.com/u/adamwolf)\
**Post date:** [August 8, 2015, 4:29pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/1 "2015-08-08T16:29:07Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![philip](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/philip/32/1505_2.png) [@philip](https://forum.beeminder.com/u/philip)\
**Post date:** [August 8, 2015, 5:42pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/2 "2015-08-08T17:42:09Z")

</div>

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

@insti and @bee probably have ideas.

---

<div class="post-metadata">

**Author:** ![insti](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/insti/32/545_2.png) [@insti](https://forum.beeminder.com/u/insti)\
**Post date:** [August 8, 2015, 7:45pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/3 "2015-08-08T19:45:50Z")

</div>

> [@adamwolf](#):
>
> Is there a way to get the API to poke my app for new data periodically

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?

---

<div class="post-metadata">

**Author:** ![adamwolf](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/adamwolf/32/484_2.png) [@adamwolf](https://forum.beeminder.com/u/adamwolf)\
**Post date:** [August 8, 2015, 7:51pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/4 "2015-08-08T19:51:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![insti](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/insti/32/545_2.png) [@insti](https://forum.beeminder.com/u/insti)\
**Post date:** [August 8, 2015, 8:05pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/5 "2015-08-08T20:05:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adamwolf](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/adamwolf/32/484_2.png) [@adamwolf](https://forum.beeminder.com/u/adamwolf)\
**Post date:** [August 8, 2015, 8:17pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/6 "2015-08-08T20:17:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [August 10, 2015, 6:18pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/7 "2015-08-10T18:18:52Z")

</div>

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](http://beemind.me) discussed here:

> [@beemind.me extra integrations](http://forum.beeminder.com/t/beemind-me-extra-integrations/992):
>
> Hi All, I’ve been using beeminder for more than a year and I love it. A while a ago I realized there are few more things I wish to track that have no native support. One of them is the procrastination level on a trello board. As I see it, the problem with current metric of counting trello cards moved to “done” is some cards tend to get left behind indefinitely. Very quickly my list got long enough so I won’t even notice the cards at the top. My proposed metric is to score a point for each day …

---

<div class="post-metadata">

**Author:** ![bluetulip](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bluetulip](https://forum.beeminder.com/u/bluetulip)\
**Post date:** [November 20, 2016, 10:18pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/8 "2016-11-20T22:18:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [November 23, 2016, 11:28pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/9 "2016-11-23T23:28:41Z")

</div>

> [@bluetulip](#):
>
> Another hack would be to use URLMinder and make the updating app return a page with the appropriate number of words.

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!

---

<div class="post-metadata">

**Author:** ![bluetulip](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bluetulip](https://forum.beeminder.com/u/bluetulip)\
**Post date:** [November 25, 2016, 12:15am UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/10 "2016-11-25T00:15:13Z")

</div>

I took that as a challenge and updated my updater.

[https://web-glue.herokuapp.com/wanikani-urlminder](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.

---

<div class="post-metadata">

**Author:** ![bluetulip](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bluetulip](https://forum.beeminder.com/u/bluetulip)\
**Post date:** [November 28, 2016, 10:31pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/11 "2016-11-28T22:31:43Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [December 3, 2016, 8:38am UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/12 "2016-12-03T08:38:27Z")

</div>

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. :))

---

<div class="post-metadata">

**Author:** ![bluetulip](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bluetulip](https://forum.beeminder.com/u/bluetulip)\
**Post date:** [December 3, 2016, 8:34pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/13 "2016-12-03T20:34:21Z")

</div>

[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.

> [@dreev](#):
>
> Also can we send you stickers and give you a discount on premium plans?

Sure!

---

<div class="post-metadata">

**Author:** ![bluetulip](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bluetulip](https://forum.beeminder.com/u/bluetulip)\
**Post date:** [December 9, 2016, 11:00pm UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/14 "2016-12-09T23:00:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [December 10, 2016, 12:14am UTC](https://forum.beeminder.com/t/api-callbacks-for-new-data/1036/15 "2016-12-10T00:14:30Z")

</div>

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.
