** Unofficial but really useful Devonthink API and Zapier Integration

I have implemented a working API for DT3 along with Zapier integration. The concepts are mine – with help from a developer to implement it. To me this solves a long-running goal to be able to access my data when away from my main computer (beyond what DT3 Server and Devonthink to Go can do) and to more easily create custom reports and otherwise integrate DT3 with other apps. It lets me keep the unique and unparalleled benefits of a desktop DT3 app and local data storage but also have the benefits of a web app.

I am glad to share this with others - with the request that this be for non-commercial use and that you share back any edits or tweaks or tricks you develop with it.

The link to the Github repository for the API is below. I have also included a link for you to request access to the installed Zapier integration; note that the Zapier integration lets you enter the URL and other credentials for your own API and Zapier does not share that with me so there is no security issue beyond what you have with any other Zapier app. If you would prefer to install the Zapier integration as your own app, just let me know and I will add you to the private Github repository where that is stored.

You can use the API by itself; if you want to use the Zapier integration then you must also have the API installed.

In simplest form, the API itself has a bulit-in web app which lets you upload or download files to/from DT3 via the Internet. But if you set up a MongoDB database (which can be done on the Mongo free tier) then the API will do a 1-way sync of your DT3 metadata to MongoDB; that then opens up the floodgates to infinite possibilities for building your own web app to access your local DT3 database.

Personally I have been using www.retool.com which is a terrific low-code front-end builder for creating a GUI front-end to access MongoDB and other databases. But you have many other options.

The Zapier integration does 3 things - you can Trigger it via a webhook using the sample Applescript provided and a SmartRule (it uses tags to select which Zap you want to trigger); then you can pass data to any Zapier app. So for example you can have a DT3 smart rule which activates Zapier to copy a file to Dropbox/Google Drive, add an item and its X-Devonthink Link and URL to a Google Spreadsheet, or whatever else you can imagine with Zapier integration.

As an Action, the Zapier integration can either upload or download files and/or nested groups to/from DT3.

One helpful benefit of the API is that Shortcuts on iOS can access an API. So there is a sample Shortcut for iOS which takes as its input an X-Devonthink link and then downloads it from DT3 and sends it to the Share Sheet location of your choice.

I have been using this for a few weeks and have found it to be really useful in my work with DT3 but clearly there are infinite ways to integrate it with Zapier, with Retool low-code apps, or with any other web app framework you prefer.

I can answer some questions on getting it working and the big-picture capabilities of the software. @8isnothing developed the software and can provide more specifics if there are bugs or technical / coding issues.

https://zapier.com/developer/public-invite/147248/30469eead92cd75448cbacf3d1cc531c/

A few screenshots to give you a flavor of what it does and looks like:

13 Likes

This is fascinating. An API seems to be the most significant feature missing from DT :+1:

Presumably, ngrok needs to be run to expose the API for Zapier to pick up?

You can use ngrok but there are other possibilities as well.

The API uses FastAPI. FastAPI includes a Python app which runs as a Terminal app to provide access to the API via a specified port. You could then use port forwarding on your router to send that port to the computer which hosts the API. Or in my case, I have a Synology NAS which has a reverse proxy feature which accomplishes that and makes the https certificate administration a bit easier.

2 Likes

I’m not great at networking, but looks like port forwarding’s not particularly secure.

boringproxy looks interesting.

That may work

The key for security is to use https - port forwarding is fine as long as you use that

1 Like

Why? Or rather: Why would port forwarding be less secure than using a port directly? In my opinion, the important thing is that you use HTTPS and make sure your site can only be accessed by authorized people. To guarantee that, you could use certificates (which are a PITA to generate, administer and install) or probably some kind of two factor authentication.

Alternatively, if your router allows, setup a VPN on the router and connect to that. Than you do not need port forwarding since your DT server and your computer are in the same network already. OTOH, VPN requires authentication, too, which means either certificates or perhaps 2FA. There are also NAS available that allow establishing a VPN, but I’m not sure if one would have to forward a port to them, too.

If the product you mentioned is for you, is not for me to judge. I just noted that macOS support is “untested” (which, given Apples notoriously problematic network implementation, might be a warning sign).

Like I said, networking’s not one of my strengths. Was reading this :man_shrugging:

Yeah, MacOS support looks sketchy. The whole project’s pretty green.

Reading through this atm.

FastAPI also lets you establish a password requirement - so it is not a public API (unless you want it to be).

I would think https plus password protection is sufficient for most uses

And if you happen to have a Synology NAS, the process of setting up the reverse proxy and maintaining https certificates is pretty easy.

Depending on the quality of the passwords… I tend to think that passwords are on their way out (and should be), but 2FA or biometrics is still too difficult to set up for individuals.

Since you mentioned it - FastAPI is open source so lots of things are possible.

I have not tried this but apparently 2FA is a possibility for those so inclined.