Popclip to Dynalist

Just needs a few tweaks. Mainly because PopClip doesn’t have an implementation of Fetch. You need to use XMLHttpRequest or Axios. Also, the network entitlement is needed.

The icon didn’t work because there’s no icon with the name bundle:inbox. I used one from Iconify.

// #popclip
// name: Add to Dynalist Inbox
// icon: iconify:material-symbols:move-to-inbox-outline
// language: javascript
// entitlements: [network]
// after: show-status
const dynalist = require('axios').create({
  baseURL: "https://dynalist.io/api/v1"
});
const token = "yourapikey"; // Enter your Dynalist API secret token here
const { data } = await dynalist.post("inbox/add", {
  token,
  content: popclip.input.text
});
if (data._code !== 'Ok') { 
  throw new Error("Dynalist error: " + data._msg);
}

(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)

Notes: