Workflowy API - Convert Shortcut to Drafts action?

The folks at Workflowy put this tweet out recently about using Shortcuts to interact with the recently-announced API functionality Workflowy now has. I’ve got this working fine.

So just wondering if someone could produce a Drafts action that achieves a similar outcome to the Shortcut linked to in the tweet, opposed to going the Shortcuts route itself? Cheers.

I can’t seem to find any mention of the API on their website, or any related documentation about the API itself, is it actually a public API?

This one function could be reverse engineered from the Shortcut, I suppose, but it would be better if they had some docs available.

Sorry, but I’ve not got any further information over that supplied above.

Here’s an example of the Shortcut recreated in Drafts:

After install, edit the action and set your Workflowy API key and node URL as used in the Shortcut as the template values for the first two action steps.

1 Like

That’s marvellous. Many thanks, Greg.

I am really curious. Did you actually get this one working?

The reason I ask is, that I am making a custom function in Mindstudio from your template, but it doesn’t seem to work.

I wonder if the error lies in the endpoint URL: https://workflowy.com/api/bullets/create/ ??

My version of the code is this:

const apiKey = ai.getConfig('workflowyApiKey');
const node = ai.getConfig('workflowyNodeUrl');
const title = ai.getConfig('bulletTitle');

const endpoint = 'https://workflowy.com/api/bullets/create/';

let http = new HTTP();
let response = http.request({
  "url": endpoint,
  "method": "POST",
  "data": {
    "new_bullet_title": title,
    "save_location_url": node
  },
  "headers": {
    "Authorization": `Bearer ${apiKey}`
  }
});

if (response.success) {
  ai.log("Workflowy bullet created");
}
else {
  ai.log(`Workflowy Error: ${response.statusCode}

${response.responseText}`);
  ai.fail();
}

Then there is ofc a configuration code also… If your code works, then this should work as well, no?

Any suggestions?

Is this a question about Drafts? I don’t know what “Mindstudio” is, but this is an example script that is specific to Drafts and would only work in a Drafts action.

Tbh no it is not. But I was curious if the code actually worked or was just a “draft” so to speak.

But I actually used it as a template for API access to Workflowy inside Mindstudio - an AI tool.

It worked with a few changes.

The reason I was skeptical is that API access to Workflowy is very new. On their web page it is only explained via Zapier… And Shortcuts for IPhone…

So it is an absolute blast that it is working… Thx