Does Anyone Have Examples of Adding to an Existing or New Notion Note using Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

Anyone have examples around adding to an existing Notion note or a new Notion note? I’ve found the Notion connection a bit unintuitive within Pipedream

Good question, is a note a page property or a type of block?

no idea.

do you know how to add notes to pages using the Notion API?

To add notes to pages using the Notion API, you’ll need to interact with the Notion API to update a page or create content within a page. While the specific endpoint to “add notes” as a distinct action isn’t directly mentioned in the provided documentation, adding content to a Notion page typically involves using the pages or blocks API to update or add new content blocks to a page. Below is an example of how you might use the Notion API to add a text block (which could serve as a note) to an existing page. This example assumes you have the page ID where you want to add the note and that you’re adding a simple text block. For more complex operations or different content types, you’ll need to refer to the Notion API documentation. import { axios } from "@pipedream/platform"; export default defineComponent({ props: { notion: { type: "app", app: "notion", }, }, async run({ steps, $ }) { const pageId = "your_page_id_here"; // Replace with your target page ID const content = "This is the note content"; // Replace with the content of your note return await axios($, { method: "patch", url: `${pageId}/children`, headers: { Authorization: `Bearer ${this.notion.$auth.oauth_access_token}`, "Notion-Version": "2021-08-16", "Content-Type": "application/json", }, data: { children: [ { object: "block", type: "paragraph", paragraph: { text: [ { type: "text", text: { content: content, }, }, ], }, }, ], }, }); }, }); This code snippet demonstrates how to add a simple paragraph block to a Notion page. Make sure to replace "your_page_id_here" with the actual ID of the page you want to add the note to, and replace "This is the note content" with the actual content of your note. For more complex notes or different types of content (like headings, lists, or images), you’ll need to adjust the data payload according to the structure expected by the Notion API