Robust TypeScript client for the unofficial Notion API.
94
Build a helper that retrieves Notion block records by ID, reports missing entries, and exposes signed file URLs when requested.
blocks map keyed by each unique ID that includes block metadata and leaves missing empty. @testmissing lists those IDs while blocks only contains entries for IDs that were found. @testincludeSignedUrls is true and a requested block contains file-based assets, the corresponding BlockRecord exposes a signedFileUrls map keyed by source URL. @testrequestOptions includes custom headers or timeout, the underlying HTTP calls use those options. @test@generates
export interface BlockRecord {
id: string;
type: string;
properties?: Record<string, unknown>;
content?: string[];
signedFileUrls?: Record<string, string>;
raw: unknown;
}
export interface FetchBlocksOptions {
includeSignedUrls?: boolean;
requestOptions?: {
timeout?: number;
headers?: Record<string, string>;
};
}
export interface FetchBlocksResult {
blocks: Record<string, BlockRecord>;
missing: string[];
}
export function createBlockFetcher(authToken: string): {
fetchBlocksById(
blockIds: string[],
options?: FetchBlocksOptions
): Promise<FetchBlocksResult>;
};Client for requesting block records from Notion workspaces.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-notion-clientevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10