Call x-callback-url from OmniJS?

Hi, I’d like to use OmniJS to invoke an x-call-back-url action in DEVONThink To Go, however it seems that is only designed to call OmniJS actions in other Omni-JS-enabled application.

Is there a way to call x-callback-urls using OmniJS?

Kind regards, Sven.d


It’s not immediately clear to me whether it is documented at all, but @kcase shared this on Twitter last night:

Not even sure that I fully understand how this would be used to return values created at run-time in the omniJS JSContext.

OK, got it – I was being slow. It does return an evaluation of the text interpreted as JS code.

This for example, returns a list of names bound in the global namespace:

1 Like

After some experimenting, it seems as if OmniJS‘s function supports calling x-callback-urls, however it seems that the function passed as a callback doesn‘t get called.

For example, the following code activates DEVONtink To Go, which calls back to OmniOutliner. However, the callback never gets executed…

var scriptURL = URL.fromString('x-devonthink://x-callback-url/get-itemlink'){console.log('a')})

Where, out of interest, are you hoping to see the console.log string ?

In OmniOutliner 3/iOS, I ran the Script directly from its console.

1 Like

If I run this code in OmniOutliner iOS console,

(() => {
	'use strict';
		strURL = 'workflow://run-workflow?name=test&input=23';

	return URL.fromString(strURL).call(x =>

It opens workflow app, and I get this output.

Collage_Fotor copy

I can successfully pass a number from OmniOutliner to Workflow and output it through OmniOutliner console. I cannot do the same with a string. I wonder why is that.

Interestingly, when I omit the x-callback-url part from my URL.fromString('x-devonthink://x-callback-url/get-itemlink') example, DEVONthink complains that this actions can only be used via x-callback-url and aborts the action. However, in your example it seems as if the x-callback-url part gets added automatically.

That’s due to a design oversight. We’ll fix it.

1 Like

Just a followup: this was fixed in OmniOutliner 5.3 for Mac and OmniOutliner 3.1 for iOS. It’s now possible to use with x-callback-url URLs that return arbitrary content (rather than only working for URLs that returned JSON).

1 Like

It works now. Thanks for the follow-up !

Could you give an example of that ?

I’m not sure if there has been a regression, but I’m getting the symptoms that was mentioned above when trying to call urls from omnioutliner pro. Whether I try to fetch or call a URL (bear:// in this case) the callbacks never fire and bear is never notified.

I can confirm that the URL is valid because if I console.log it and then load it in chrome, it all works as expected.