Community Creations
Supernotes to Drafts
Creates a new card in Supernotes using the Drafts’ title and body.
Configuration
- Replace
YOUR-SUPERNOTES-API-KEY
with your Supernotes API key.
How it works
- Extracts the Draft’s title and body using templates.
- Sends a POST request to the Supernotes API to create a new card.
- Logs an error and fails the action if the request fails.
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();
}
Note
Make sure to replace YOUR-SUPERNOTES-API-KEY
with your actual Supernotes API key.