Quick capture with Drafts?

Hey there,

Has anyone seen an integration with the Drafts app to quickly create a new card in Supernotes with the 1st line as the title and the rest as the body?

Seems like it’d be a good fit for a getdrafts.com action.

1 Like

Not sure how to set it up in Drafts, but here is an example in Shortcuts app that may lead you in the direction you’re looking for:

I created an action in Drafts to do just that a while back. Here is a screenshot and the code in case it helps someone else (source of the code: I don’t remember)

var http = HTTP.create();

let title = draft.processTemplate("[[title]]");
let body = draft.processTemplate("[[body]]");

var response = http.request({
  "url": "https://api.supernotes.app/v1/cards/simple",
  "method": "POST",
  "headers": {
       "Api-key": "YOUR-SUPERNOTES-API-KEY",
       "Content-Type": "application/json",
  },
  "data": {   
         "icon": "",
         "name": title,
         "markup": body
    }
});

if (response.error) {
console.log(response.error)
context.fail();
}
1 Like

@tobias does the above action no longer work with the new API? I started to get an error using something similar just in the last few days.

Hi @Itsben, it should work. What’s the error you receive?

HTTP.request Failed: 207, Unknown error

Just checking if someone could help me with this?

1 Like

I don’t use Drafts so probably not the best to answer, but I will take a look this weekend and see what I can come up with. :slight_smile: