Working Copy round trip : fetch

Posted by @derekvan, Last update over 5 years ago

This script will allow you to choose any file from a working copy repo and import it to Drafts. It also copies the universal URL of the file, so that when you use the associated “put” Drafts action, the file commits without needing any input from the user about where to save it.


  • script

    // Working Copy fetch
    // Grab file from working copy, prepend with universal URL link to facilitate git commit 
    const credential = Credential.create("Working Copy Key", "The URL key for Working Copy");
    credential.addTextField("key", "URL key");
    const key = credential.getValue("key");
    const baseURL = "working-copy://x-callback-url/read/?";
    var cb = CallbackURL.create();
    cb.baseURL = baseURL;
    cb.addParameter("type", "url");
    let success =;
    var wcf = CallbackURL.create();
    wcf.baseURL = baseURL;
    let good =;
    let d = Draft.create();
    d.content = cb.callbackResponse.url + "\n" + wcf.callbackResponse.text;


  • After Success Default
    Notification Error
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.