This val provides a function saveToTana allows the creation of nodes in Tana via their Input API. The parameters are as follows:
One way to use this val is with a web endpoint that you can send data to to have parsed and submitted to Tana as a specific type of node. For example, this val
import { saveToTana } from "https://esm.town/v/nbbaier/saveToTana";
import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes";
import { Hono } from "npm:hono";
const token = Deno.env.get("tanaInputAPI");
export const honoTanaEndpoint = async (req: Request) => {
const app = new Hono();
app.get("/", async c => {
let { text, url } = c.req.query();
const payload: APIPlainNode = {
name: text,
children: [
{
type: "field",
attributeId: "cwi23sOzRSh8",
children: [
{
dataType: "url",
name: url,
},
],
},
],
supertags: [],
};
const newNode = await saveToTana(token, payload);
return c.json({ newNode });
});
return app.fetch(req);
};
Combined with a Chrome extension like Rich URL, the above val allows one to send selected text on a page along with that pages URL to Tana via the val's public GET endpoint.
Migrated from folder: projects/tana/saveToTana