import { Client } from "npm:@notionhq/client";
import type { CreatePageParameters } from "npm:@notionhq/client/2.2.4/build/src/api-endpoints.js";
/**
* Windmill script to create a new page in Notion
* Reference: https://developers.notion.com/reference/post-page
*/
type Notion = {
token: string;
};
export async function main(auth: Notion, database_id: string, properties: object, children: object[] = []) {
const client = new Client({ auth: auth.token });
return await client.pages.create({
parent: {database_id},
properties,
children: children as CreatePageParameters["children"],
});
}
Submitted by raysuhyunlee207 53 days ago