Available today
TypeScript SDK
The official library for Node.js 22 or later. One call creates a task, another waits for the decision, and a helper checks the callback's signature before you act. Retries and idempotency are built in.
Where it fits
- TypeScript SDK
- TaskToHuman
- The person who decides
- Signed decision back to your code
- Signed decision back to your code
What it does
createTask,getTask,listTasks(or every page withlistAllTasks) andcancelTask, plus task types, humans and the files a person sent.waitForDecisionchecks the task until a person decides, for scripts, tests and short agent turns; in production, a callback brings the decision.verifyCallbackchecks theTTH-Signatureheader against the raw body and returns the task. A missing secret throws, so the check can't be switched off by accident.- No runtime dependencies, ESM with type declarations, an
Idempotency-Keyon every create and safe retries. Open source under the Apache License 2.0.
Set it up
Run
npm install @tasktohuman/sdkin your server project.Create an API key for the workspace, a test key first, and keep it in
TTH_API_KEY. Use it on your server only.Create a task with
createTask, then act on the verified callback, or wait withwaitForDecision.
// npm install @tasktohuman/sdkimport { TaskToHuman } from "@tasktohuman/sdk";const tth = new TaskToHuman({ apiKey: process.env.TTH_API_KEY });const task = await tth.createTask( { task_type: "approve_refund", title: "Refund €249 to order #4821?", payload: { order_id: "4821", amount: 249, reason: "Arrived damaged" }, callback_url: "https://shop.example.com/hooks/tasktohuman", deadline_minutes: 120, }, { idempotencyKey: "refund-4821" }, // a retry with the same key returns the same task);// task.state is "notified"; the decision comes to callback_url, signed.