Node.js Package
Text2Tana
Write a line of text. Get a Tana API payload. Fast, repeatable data entry without the JSON.
View on GitHub ↗
Text input
Buy oat milk @inbox #todo due:tomorrow
→
Tana API payload
{
"targetNodeId": "inbox-node-id",
"nodes": [{
"name": "Buy oat milk",
"supertags": [{
"id": "todo-tag-id"
}],
"fields": [{
"attributeId": "due-field-id",
"children": [{
"name": "tomorrow"
}]
}]
}]
}
Syntax
Intuitive symbols
Each token in the input text maps to a specific part of the Tana data model. The symbols are designed to be easy to remember and quick to type.
| Token | Example | Maps to |
|---|---|---|
| @nodename | @inbox | Target node — where the new node is added |
| #tagname | #todo | Supertag applied to the node |
| field:value | due:tomorrow | Field assignment on the node |
| https://… | https://example.com | URL field on the node |
| (plain text) | Buy oat milk | Node name |
Usage
Three steps
1 — Install
Add the package to your project. It uses ES modules and has no runtime dependencies.
2 — Configure
Pass a schema that maps your workspace's node names, supertags, and field names to their Tana IDs.
3 — Parse
Call api_payload(text) with a line of text. POST the result to the Tana Input API.
import Text2Tana from 'text2tana';
const schema = {
nodes: { inbox: 'TANA_NODE_ID' },
supertags: { todo: 'TANA_TAG_ID' },
fields: { due: 'TANA_FIELD_ID' },
};
const tana = new Text2Tana(schema);
const payload = tana.api_payload('Buy oat milk @inbox #todo due:tomorrow');
// POST payload to https://europe-west1-tagr-prod.cloudfunctions.net/addToNodeV2
Details
What to expect
- Parses targets, supertags, fields, and URLs from a single line of text
- Extend the built-in schema with your own workspace node, tag, and field mappings
- Intermediate "natural language object" format for custom processing before sending
- ES module — no CommonJS, no bundler required
- No runtime dependencies
- Open source, GPL-3.0