Action

Add to Tana

Posted by jason, Last update about 1 year ago

Add entry to your Tana Inbox node.

To use:
* Create a node for entries to be added to. For example: I added one called Inbox on the root node.
* Open the node, then hit CMD+k and select Get API Token (Does not work in Firefox or Safari; use Chrome for this step). This will generate a token for this node only.
* Create a new draft and select this action. You will be prompted for the API key

Steps

  • script

    const credential = Credential.create(
      "tana", 
      "Tana.inc\nPress cmd+k and select 'Get API Token' on your inbox node"
    );
    
    credential.addPasswordField(
      "token",
      "Token",
    );
    
    if (!credential.authorize()) {
      alert("No API token provided or found.");
      context.fail(
        "Tana API token not entered, or not found. Clear API token and try again if no prompt was provided."
      );
    }
    
    const content = encodeURI(draft.content);
    const url = `https://europe-west1-tagr-prod.cloudfunctions.net/addToNode?note=${content}`;
    
    const http = HTTP.create();
    const response = http.request({
      "url": url,
      "method": "GET",
      "headers": {
        "Authorization": `Bearer ${credential.getValue("token")}`,
        "Content-Type": "application/json",
      }
    });

Options

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