← Notion

Create Page from Database with Notion API

Pipedream makes it easy to connect APIs for Notion and 1400+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
Create Page from Database with the Notion API
No credit card required

Overview

The Notion Create Page from Database action allows you to add pages to a Notion Database.

This action features easy to use dropdowns that automatically populate your databases as well as your database's properties, also known as columns.

This action interacts with the Notion create a Page API endpoint. The Database selected in the Parent Database ID is used as the parent_id parameter to that endpoint so the page is added to your databaset .

Getting Started

Follow this short 4 minute guide to connect your Notion account and add new Database pages

Props

When using the Create Page from Database action, there are several props to define:

  1. Notion Account - see the Accounts section below.
  2. Parent Database ID - the database to add a page to.
  3. Meta Types - an icon or cover to add to the new page (optional).
  4. Property Types - one or more properties to add to the new page that correspond with columns in the database.
  5. Page Content - the content of the page that appears when it's opened in a side view.

Each selected Property Type will also add a new prop for that given column.

Accounts

  1. Visit https://pipedream.com/accounts.
  2. Click on the Click Here To Connect An App button in the top-right.
  3. Search for "Notion" among the list of apps, and select it.
  4. This will open a new window asking you to allow Pipedream access to your Notion workspaces and pages. Choose which workspaces and pages you'd like to use in Pipedream, then click Allow.
  5. That's it! You can now use this Notion account in any actions, or link it to any code step.

Within a workflow

  1. Create a new workflow.
  2. Select your trigger (HTTP, Cron, etc.).
  3. Click on the + button below the trigger step, and search for "Notion".
  4. Select the Create Page from Database action.
  5. Click the Connect Account button near the top of the step. This will prompt you to select any existing Notion accounts you've previously authenticated with Pipedream, or you can select a New account. Clicking New opens a new window asking you to allow Pipedream access to your Notion workspaces and pages. Choose the workspaces and pages where you'd like to install the app, then click Allow.
  6. That's it! You can now connect to the Notion API using any of the Slack actions within a Pipedream workflow.
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜

Trusted by 500,000+ developers from startups to Fortune 500 companies

Adyen logo
Brex logo
Carta logo
Checkr logo
Chameleon logo
DevRev logo
LinkedIn logo
Netflix logo
New Relic logo
OnDeck logo
Replicated logo
Scale AI logo
Teamwork logo
Warner Bros. logo
Xendit logo

Developers Pipedream

Integrations

Create Page from Database with Notion API on New Requests (Payload Only) from HTTP / Webhook API
HTTP / Webhook + Notion
 
Try it
Create Page from Database with Notion API on New Message from Discord API
Discord + Notion
 
Try it
Create Page from Database with Notion API on New Message In Channels from Slack API
Slack + Notion
 
Try it
Create Page from Database with Notion API on New Message in Channel from Discord Bot API
Discord Bot + Notion
 
Try it
Create Page from Database with Notion API on New Submission from Typeform API
Typeform + Notion
 
Try it

Details

This is a pre-built, source-available component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Create Page from Database on Notion
Description:Creates a page from a database. [See the docs](https://developers.notion.com/reference/post-page)
Version:0.1.6
Key:notion-create-page-from-database

Code

import { pick } from "lodash-es";
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
  ...base,
  key: "notion-create-page-from-database",
  name: "Create Page from Database",
  description: "Creates a page from a database. [See the docs](https://developers.notion.com/reference/post-page)",
  version: "0.1.6",
  type: "action",
  props: {
    notion,
    parent: {
      propDefinition: [
        notion,
        "databaseId",
      ],
      label: "Parent Database ID",
      description: "The identifier for a Notion parent page",
      reloadProps: true,
    },
    metaTypes: {
      propDefinition: [
        notion,
        "metaTypes",
      ],
    },
    propertyTypes: {
      propDefinition: [
        notion,
        "propertyTypes",
        (c) => ({
          parentId: c.parent,
          parentType: "database",
        }),
      ],
    },
    pageContent: {
      type: "string",
      label: "Page Content",
      description: "Content of the page. You can use Markdown syntax [See docs](https://www.notion.so/help/writing-and-editing-basics#markdown-&-shortcuts)",
    },
  },
  async additionalProps() {
    const { properties } = await this.notion.retrieveDatabase(this.parent);
    const selectedProperties = pick(properties, this.propertyTypes);
    return this.buildAdditionalProps({
      properties: selectedProperties,
      meta: this.metaTypes,
    });
  },
  methods: {
    ...base.methods,
    /**
     * Builds a page from a parent database
     * @param parentDatabase - the parent database
     * @returns the constructed page in Notion format
     */
    buildPage(parentDatabase) {
      const meta = this.buildDatabaseMeta(parentDatabase);
      const properties = this.buildPageProperties(parentDatabase.properties);
      const children = this.createBlocks(this.pageContent);
      return {
        ...meta,
        properties,
        children,
      };
    },
  },
  async run({ $ }) {
    const parentPage = await this.notion.retrieveDatabase(this.parent);
    const page = this.buildPage(parentPage);
    const response = await this.notion.createPage(page);
    $.export("$summary", "Created page successfully");
    return response;
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
NotionnotionappThis component uses the Notion app.
Parent Database IDparentstringSelect a value from the drop down menu.
Meta TypesmetaTypesstring[]Select a value from the drop down menu:iconcover
Property TypespropertyTypesstring[]Select a value from the drop down menu.
Page ContentpageContentstring

Content of the page. You can use Markdown syntax See docs

Troubleshooting

If your database doesn't appear under the options, try deleting your Notion account connection and reconnecting.

There's an issue with Notion Databases not appearing in the options if the Database was created after you connected your Notion account to Pipedream.

Authentication

Notion uses OAuth authentication. When you connect your Notion account, Pipedream will open a popup window where you can sign into Notion and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Notion API.

Pipedream requests the following authorization scopes when you connect your account:

About Notion

All-in-one workspace for notes, tasks, wikis and more

More Ways to Use Notion

Triggers

New Database from the Notion API

Emit new event when a database is created. Note: Databases must be shared with your Pipedream Integtration to trigger event.

 
Try it
New Page in Database from the Notion API

Emit new event when a page in a database is created

 
Try it
Page or Subpage Updated from the Notion API

Emit new event when a page or one of its sub-pages is updated.

 
Try it
Updated Page ID from the Notion API

Emit new event when a selected page is updated

 
Try it
Updated Page in Database from the Notion API

Emit new event when a page in a database is updated. To select a specific page, use Updated Page ID instead

 
Try it

Actions

Append Block to Parent with the Notion API

Creates and appends blocks to the specified parent. See the docs

 
Try it
Create Page with the Notion API

Creates a page from a parent page. The only valid property is title. See the docs

 
Try it
Duplicate Page with the Notion API

Creates a new page copied from an existing page block. See the docs

 
Try it
Find a Page with the Notion API

Searches for a page by its title. See the docs

 
Try it
Query Database with the Notion API

Query a database. See the docs

 
Try it

Explore Other Apps

1
-
12
of
1400+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Schedule
Schedule
Trigger workflows on an interval or cron schedule.
Beta
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
Beta
Data Stores
Data Stores
Use Pipedream Data Stores to manage state throughout your workflows.
Telegram Bot
Telegram Bot
Telegram is a cloud-based instant messaging and voice over IP service
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular apps like ChatGPT and DALL·E 2.
Google Sheets
Google Sheets
With Google Sheets, you can create, edit, and collaborate wherever you are
Discord
Discord
Use this app to create a Discord source that emits messages from your guild to a Pipedream workflow.
GitHub
GitHub
Where the world builds software. Millions of developers and companies build, ship, and maintain their software on GitHub—the largest and most advanced development platform in the world.
Formatting
Formatting
Pre-built actions to make formatting and manipulating data within your workflows easier.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.