Using Napkin API with Drafts

I have recently started using Napkins app for a part of my notes. They have launched their API
Is there a way to use the API to send my drafts to Napkin? Sorry but I have no knowledge on coding and APIs, hence requesting for help here.

I don’t have access to Napkin, and that page you linked to seems to be the only available documentation regarding an API – so lots of caveats, but simply speaking the Drafts version of the curl post example in that link would look something like the below. You would need to modify to add your account email and token from Napkin - and maybe a way to provide a sourceUrl value if that is a required field.

const email = "my@email.com"
const token = "my-napkin-token"

// assume you want to post the whole current draft...
let thought = draft.processTemplate("[[draft]]")
// don't know if a URL is required? No docs?
let sourceUrl = ""

let http = HTTP.create(); // create HTTP object

var response = http.request({
    "url": "https://app.napkin.one/api/createThought",
    "method": "POST",
    "data": {
        "email": email,
        "token": token,
        "thought": thought,
        "sourceUrl": sourceUrl
    }
});

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

Thank you so much! This is very helpful