Jacob Evans

Integrating ChatGPT with Tinderbox Using Shortcuts

Like many of us these days, I use ChatGPT to streamline various productivity workflows. This week, I set out to integrate Tinderbox with ChatGPT to enhance my note-taking and thought organization.

Below is a simple yet flexible integration that requires minimal command-line (or Terminal) knowledge. No API sign-ups or subscriptions are needed—this works with the free version of ChatGPT. However, you do need to have the ChatGPT macOS app installed and set up.

Setup Steps

Get the integration working by following five simple steps.

  1. Install the Shortcut. First, install this Shortcut, which allows Tinderbox to send input and receive output from the macOS ChatGPT app. Here’s a screenshot if you want to create it yourself. (NOTE: The name of the shortcut needs to match the Shortcut name specified in the following step, which is ChatGPT.)

  2. Add Functions to Tinderbox’s “Library”. Next, add the following three functions to a note in your Tinderbox “Library” located in /Hints/Library:

    //
    // Returns the POSIX directory in which this TBX
    // file is located.
    //
    // NOTE: If the document's path contains special RegEx
    // chars, this function may fail.
    //
    function getDir() {
       return document["path"].replace("/" + document["name"]);
    }
    
    //
    // Runs the "shortcuts" command with the specified
    // shortcut name and input in data.
    //
    function runShortcut(stdin, shortcut) {
        // Construct the Shortcut command
        var:string cmd = 'shortcuts run "' + shortcut + '"';
    
        return runCommand(cmd, stdin, getDir()).trim;
    }
    
    //
    // Prompts ChatGPT with the given text.
    //
    function promptChatGPT(text) {
        // Display a waiting message
        show("⏳ Prompting ChatGPT, please wait...");
    
        return runShortcut(text, "ChatGPT");
    }
    

    The second function, runShortcut(), allows you to run any Shortcut, while the third function, promptChatGPT(), calls runShortcut() to execute the ChatGPT Shortcut that was added in Step 1.

  3. Create a Stamp to Send Notes to ChatGPT. Next, create a Stamp that runs the promptChatGPT() function, using the $Text of the selected note(s) as the prompt:

    $Text += "\n\n---\n\n" + promptChatGPT($Text) + "\n\n---\n\n";
    

    NOTE: This Stamp appends the ChatGPT results to the selected note(s) using the selected notes' $Text as input, effectively simulating a “chat”.

  4. Run the Stamp. Create a new note with a prompt as its $Text and apply the Stamp created in the previous step to it.

  5. Use and Enjoy 🍻. That’s it! Now, you can use this setup to quickly query ChatGPT from within Tinderbox.

Limitations & Future Enhancements

One downside to this approach is that each time you prompt ChatGPT, it starts a new chat. Unfortunately, there doesn’t seem to be a way to programmatically delete chats or mark them as temporary. If anyone finds a workaround, I’d love to hear about it!

I hope this integration proves as useful for you as it has for me. Happy Tinderboxing!

Previous:
Next: