Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.notion.com/llms.txt

Use this file to discover all available pages before exploring further.

Get up and running with Workers in a few steps.

Prerequisites

Node.js

Version 22 or higher

npm

Version 10 or higher

Create your first worker

1

Install the CLI

curl -fsSL https://ntn.dev | bash
2

Initialize a new project

Scaffold a new worker project:
ntn workers new
Choose a folder name when prompted.
3

Deploy to Notion

Connect to your Notion workspace and deploy:
ntn workers deploy
Follow the prompts to authenticate with your Notion workspace.
4

Run the sample tool

Execute the included sample tool:
ntn workers exec sayHello -d '{"name": "World"}'

What’s in a worker?

The scaffolded project lives in src/index.ts and exports a single Worker instance:
src/index.ts
import { Worker } from "@notionhq/workers";

const worker = new Worker();
export default worker;

worker.tool("sayHello", {
  title: "Say Hello",
  description: "Returns a friendly greeting",
  schema: {
    type: "object",
    properties: {
      name: { type: "string" },
    },
    required: ["name"],
    additionalProperties: false,
  },
  execute: ({ name }) => `Hello, ${name}!`,
});

Next steps

https://mintcdn.com/notion-demo/7WdlNb9IZkRhGCcR/icons/nds/arrowCircleLoopForward.svg?fit=max&auto=format&n=7WdlNb9IZkRhGCcR&q=85&s=25d8d1ea2405c9af06347df80ab90fcf

Syncs

Sync external data into Notion databases.
https://mintcdn.com/notion-demo/7WdlNb9IZkRhGCcR/icons/nds/aiFace.svg?fit=max&auto=format&n=7WdlNb9IZkRhGCcR&q=85&s=d473a8d294324c9f2e19f44d487744dd

Agent tools

Build custom tools for Notion AI.
https://mintcdn.com/notion-demo/7WdlNb9IZkRhGCcR/icons/nds/lightning.svg?fit=max&auto=format&n=7WdlNb9IZkRhGCcR&q=85&s=c9a479b1d46711f4edc71c5f9187e5bd

Automations

Create custom automation actions.
https://mintcdn.com/notion-demo/yKfkO8UsVZTLLPNp/icons/nds/bell.svg?fit=max&auto=format&n=yKfkO8UsVZTLLPNp&q=85&s=0ee1c6e084361d853c48609a1f989a2c

Webhooks

Receive HTTP events from external services.
https://mintcdn.com/notion-demo/yKfkO8UsVZTLLPNp/icons/nds/pathRoundEnds.svg?fit=max&auto=format&n=yKfkO8UsVZTLLPNp&q=85&s=f1b9491091d34c2249a03218696218a3

OAuth

Connect to third-party APIs.