Edge function int-notion-page-content Reads the full content (blocks) of a Notion page — paragraphs, headings, lists, code blocks — and returns both structured blocks and plain text.. Written in aerostack and deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.
npx aerostack add navin/int-notion-page-contentUse with AI Assistants
MCPConnect Claude, Cursor, or any MCP-compatible client — then call this function by slug
① Add MCP Server
Add this once — access all Aerostack functions from your AI tool.
{
"mcpServers": {
"aerostack": {
"url": "https://mcp.aerostack.dev",
"type": "http"
}
}
}② Call this function
Ask your AI to use the call_function tool with this slug:
call_function({
slug: "int-notion-page-content",
args: {}
})int-notion-page-content — Read the body content of a Notion page
Retrieves all content blocks (paragraphs, headings, lists, code, etc.) from a Notion page and returns both structured blocks and a plain text version.
Setup
Environment Variables
| Variable | Required | Description |
|---|---|---|
NOTION_API_KEY | Yes | Notion integration token — get yours at https://www.notion.so/my-integrations |
How to set up:
- Go to notion.so/my-integrations and create an integration
- Copy the Internal Integration Secret (starts with
ntn_orsecret_) - In Notion, share your page/database with the integration (click ... → Connections → your integration)
- In your Aerostack dashboard, go to Project → Secrets → Add secret
- Key:
NOTION_API_KEY— Value: your integration token
API
POST /api/int-notion-page-content
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
pageId | string | Yes | — | The Notion page ID to read content from |
pageSize | number | No | 100 | Number of blocks to return (1-100) |
startCursor | string | No | — | Pagination cursor from a previous response |
Success response (200)
{
"success": true,
"data": {
"blocks": [
{ "id": "block-id-1", "type": "heading_1", "text": "Introduction", "hasChildren": false },
{ "id": "block-id-2", "type": "paragraph", "text": "This is the first paragraph...", "hasChildren": false }
],
"plainText": "Introduction\nThis is the first paragraph...",
"hasMore": false,
"nextCursor": null,
"count": 2
}
}
Usage
cURL
curl -X POST "$FUNCTION_URL" \
-H "Content-Type: application/json" \
-d '{ "pageId": "your-page-id" }'
Use Cases
- Content publishing: Read a blog post draft from Notion to publish to your blog or social media.
- AI processing: Feed page content as plain text to an LLM for summarization, translation, or reformatting.
- Cross-platform sync: Read Notion content and sync it to other platforms.
Notes
plainTextconcatenates all block text with newlines — ideal for feeding to an LLM.- Nested blocks (e.g., toggle children) are indicated by
hasChildren: true. Use the child block'sidaspageIdto read nested content. - Maximum 100 blocks per request. Use
startCursorfor pagination on long pages.
Metadata
Tags
Publisher
@navin
Required Secrets
Add these in your Aerostack dashboard under Project → Secrets.
- key
NOTION_API_KEYNotion integration token — authenticates API requests to your Notion workspace.
Build and publish your own functions
Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.
More ai Functions
Browse ai Functions →ai-chunk-overlap
by @navin
Splits text into overlapping chunks with configurable size, overlap, and boundary snapping (char, word, sentence) for RAG and embedding pipelines.
ai-context-window-fit
by @navin
Trims a conversation message array to fit within a model's context window using configurable strategies, without making any API calls.
ai-cost-estimate
by @navin
Calculates the API cost for an LLM request given a model name, prompt token count, and completion token count, supporting multiple currencies.
ai-extract-keywords
by @navin
Extracts the top N keywords from text using TF-IDF inspired scoring with built-in English stopword filtering, no external API calls required.
ai-guardrail-injection-detect
by @navin
Scores text for common prompt injection attack patterns including role overrides, instruction leaking, and jailbreak attempts.
ai-language-detect
by @navin
Detects the natural language of a text string using character trigram frequency analysis, supporting 13 languages with no external API calls.
Frequently asked questions
What does the int-notion-page-content function do?+
int-notion-page-content is a typescript edge function in the Ai category. It runs on aerostack with native access to database, cache, queue, AI, and storage bindings — call it from any AI workspace or directly as a REST endpoint.
How do I deploy int-notion-page-content to my Aerostack workspace?+
Install from the Aerostack marketplace in one click, or via CLI: aerostack install function navin/int-notion-page-content Once installed it appears in your workspace tools and any connected AI agent can call it.
What runtime does int-notion-page-content use?+
int-notion-page-content runs on aerostack via the Aerostack edge runtime. Aerostack injects native bindings (DB, KV cache, AI, vector search, storage, queue) so the function has zero-latency access to backend primitives without making HTTP round-trips.
Can I fork and customize int-notion-page-content?+
Yes. Fork int-notion-page-content from your Aerostack dashboard, modify the source (typescript), and redeploy. All changes are version-controlled and the original remains available to revert to.