Popclip to Dynalist

I have been using popclip and dynalist for years and have been struggling to send letters from popclip to dynalist but it doesn’t work. Can anyone help me with this?

You said you have been trying to make an extension, perhaps you could share what you have tried already and I could help. I’ll leave a few notes here and see if I can take a proper look later.

Notes

Thanks for the reply.
I am trying to implement it using the api functionality as you mentioned but it doesn’t work.

I can install it, but I can’t get the icon to work. When I tap on the icon, the faction mark pops up.

// #popclip
// name: Add to Dynalist Inbox
// icon: bundle:inbox
// language: javascript

const API_KEY = "yourapikey"; // Enter your Dynalist API key here
const API_URL = "https://dynalist.io/api/v1/inbox/add"; // URL of Dynalist API

// Get PopClip input text

const selectedText = popclip.input.text;

// Prepare data to send to API
const data = {
  "token": API_KEY,
  "content": selectedText
};

// Send API request
fetch(API_URL, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(data),
})
  .then(response => response.json())
  .then(data => {
    console.log('Success:', data);
    // Write the process at the time of success here
  })
  .catch((error) => {
    console.error('Error:', error);
    // Write the error processing here
  });

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:

It works like magic! Thanks for the support!

1 Like