"Streaming" (or webhook) API

Are there any plans for some sort of “streaming” or webhook-based API/integration options for Dynalist? I’d love to be able to somehow “subscribe” and be informed about changes to a list, so that I could then do something else with those changes.

In my specific case – when an item on a list is checked off, I want to receive a notification of that so that I can trigger another action in a completely different system.

6 Likes

I want to do stuff like this too.

If we do it with what exists now, we could get the whole document every 61 seconds in json via POST https://dynalist.io/api/v1/doc/read
{“token”: “”,“file_id”: “”} and then diff and parse on our side all this type stuff:

{
  "_code": "OK",
  "_msg": "",
  "title": "Todo list",
  "nodes": [
    {
      "id": "<node #1 id>",
      "content": "Buy milk",
      "note": "2L whole milk",
      "checked": true,
      "collapsed": false,
      "parent": "root",
      "children": []
    },
    {
      "id": "<node #2 id>",
      "content": "Send Jason photos",
      "checked": false,
      "collapsed": false,
      "parent": "root",
      "children": [
        "<node #3 id>",
        "<node #4 id>"
      ]
    },
    {
      "id": "<node #3 id>",
      "content": "Picnic photos",
      "checked": false,
      "collapsed": false,
      "parent": "<node #2 id>",
      "children": []
    },
    {
      "id": "<node #4 id>",
      "content": "Cruise photos",
      "checked": true,
      "collapsed": false,
      "parent": "<node #2 id>",
      "children": []
    }
  ]
}

It seem too intimidating to me. It would probably require some AWS type service running a python.py file that does the diff/parse/send trickery. I’m a noob and it would take me forever to figure out.

But I do wish for it, mainly for geofence triggering to notify me the contents of a node, like the children of my “when i get home” node in my android notification right there to read without opening anything, that would be nice.

2 Likes

I also have a similar need but a different use-case. I want to know when an item is added to a list (an inbox flag would also be great) to be able to manipulate it immediately afterwards (e.g. move it based on some criteria).

I see, thanks for your input!

@Shida - How hard is setting up webhook API?

There’s a high probability we can setup some kind of notification service for notifying documents being changed, without the changed content. Once someone receive this, they can fetch the document from our API and figure out if their items was changed.

I’m wondering if this will be sufficient to solve the use cases people have… Let me know!

2 Likes

I think that would work, yes. I’d just need to grab/store a copy of the doc and compare it to figure out what changed each time. A little extra work on my side, but I think it’d work :slight_smile:

One note – you’ll probably want to “debounce” the frequency of the notifications a bit somehow, to avoid sending bursts of a bunch of notifications e.g. for typing (one per character?!) or even checking off a series of items (do I get one notification per check? one per 10 seconds?). Not sure how that should work.

Thanks for considering!

Is there any update on this?

I am looking to trigger a github action if I add/update an item in a list

lol

https://apidocs.dynalist.io/

Instead of a webhook which requires dynalist to manage the list of endpoints, it may be sufficient to be able to query changed documents since a timestamp. Looping through changed documents is much easier than having to diff all the documents.

This feature already exits. You can query document versions.

You can get a whole raw document version, but he’s asking for a lot more parsing and logic than that

A simple notification webhook that a document was changed would be a neat addition to the API “toolbox”. My API work currently revolves around scheduled or otherwise triggered access to the API to see if anything needs to be done.

For my use-case, a simple webhook firing when a document has changed would be sufficient. I’m using Dynalist as the back-end for a statically generated blog, so anything that could notify my build service that there have been changes made would be awesome :slight_smile:

1 Like

If you can figure out the code on your build service to do a POST to the API and if the version number it returns had incremented then the document was updated

POST https://dynalist.io/api/v1/doc/check_for_updates

Example request:

{
  "token": "<your api secret token>",
  "file_ids": [
    "<document id 1>",
    "<document id 2>"
  ]
}

Example response:

{
  "_code": "OK",
  "_msg": "",
  "versions": {
    "<document id 1>": 15,
    "<document id 2>": 28
  }
}

The new IFTTT Pro can query a web hook every hour and you can write javascript for the response right in IFTTT Pro

im not too sure how you would store the version number (to see if its different than last hour). it might be several if-thans, reading to and writing to a google sheet or something.

once you get that working, it’s in IFTTT, you can trigger it when dynalist is updated (on the hour)

you can also trigger webhooks to whatever your server is

1 Like

Thanks for the thoughtful reply. A cron job (or a cron-like mechanism, like IFTTT) would work.

I was hoping for a solution with the opposite order of operations though. I finish editing a document, Dynalist pings a specific address with a tiny JSON payload (though truthfully just the request itself would be enough), then the build step would fire up on demand.

Generating a blog from Dynalist is a fun idea though.

Someone should try it. IFTTT Pro “Dynalist node to blog post” recipe.

POST https://dynalist.io/api/v1/doc/read will give you the whole document as a text json array

{
...
      "content": "blog blog blog blog blog",

IFTTT and Zapier both can do a POST and run javascript regex to parse out the text, and both can post to most blogging platforms

It’s just more coding challenge than I care to take on

the IFTTT filter would look something like

const regex = blahblah/gm;

let boo = {

 
};

let body = JSON.stringify(boo);
MakerWebhooks.makeWebRequest.setBody(body);

Some day I will take on the challenge…not any time soon tho…

And I guess you would want to trigger it on any change, and edit the original blog post. Ok it seems too challenging to be worth bothering with actually. Obsidian Pro can publish directly to a website already.

Not a blog, but I use Dynalist as the data source for a “my current projects” type website.

My Dynalist document contains a section where I list projects as bullet points under a few subheadings.

I built a website with the 11ty static site generator which uses dynalist-js to pull data from the Dynalist API and creates HTML from it.

The code is on GitHub. The site is hosted on Vercel which automatically deploys when I change the code or when I click a special “deploy” link which I’ve placed in my Dynalist document. I could also set up a “GitHub Actions” job to redeploy automatically every day.

The code is cobbled together for my use case, but the basic idea could be used for any number of websites. 11ty is great for blog-type sites.

(An automatic site deployment as soon as I change my document is the only bit missing from this scenario, but personally I don’t need it that much. I also don’t really know how one (neither on the Dynalist side nor on the user side) would handle a streaming API properly, since Dynalist will update your document more or less as you type. (Do this: Open the Dynalist and dynalist.io side by side, then start typing in the app. You’ll see updates every few seconds in the website even while you are typing one sentence) So if you change more than a few characters it would (have to) trigger numerous updates.)

I’d love to be able to create a blog based on a Dynalist outline. The only outliner I’ve found that can do this is Dave Winer’s Little Outliner but I’m not a fan of that app.

It would be great if Dynalist could support dynamic blog creation. The sharing links get partly there, but not quite.