[notion] error when trying to append block to page

hi! i’m trying to build a workflow that automatically adds a page in a database when there’s a new event in my google calendar, with the description of the event being the page content of the entry. (i’m aware that there’s the “New Page from Database” action, but i needed to make the title have a hyperlink; for now i’m just adding an append_block step that updates the page content, but i’d like to know what i’ve done wrong) i tried looking through the notion api docs and copied some of the code, but it’s returning an error.

return await axios($, {
      method: `POST`,
      url: `https://api.notion.com/v1/pages`,
      headers: {
        Authorization: `Bearer ${this.notion.$auth.oauth_access_token}`,
        "Notion-Version": `2021-08-16`,
      },
      data: {
        parent: {
          'database_id': databaseID
        },

        properties: {

            //other properties left out

            'children': {
              "object": "block",
              "paragraph": {
                 "rich_text": [
                       {
                            "text": {
                               "content": description //this is the description i want to add
                            }
                       }
                   ],
                  "color": "default"
               }
            }
          }
      }
    })

i’m getting a 400 Bad Request error, here’s what it’s telling me:

body failed validation. Fix one:
body.properties.children.title should be defined, instead was undefined.
body.properties.children.rich_text should be defined, instead was undefined.
body.properties.children.number should be defined, instead was undefined.
body.properties.children.url should be defined, instead was undefined.
body.properties.children.select should be defined, instead was undefined.
body.properties.children.multi_select should be defined, instead was undefined.
body.properties.children.people should be defined, instead was undefined.
body.properties.children.email should be defined, instead was undefined.
body.properties.children.phone_number should be defined, instead was undefined.
body.properties.children.date should be defined, instead was undefined.
body.properties.children.checkbox should be defined, instead was undefined.
body.properties.children.relation should be defined, instead was undefined.
body.properties.children.files should be defined, instead was undefined.
body.properties.Name.id should be defined, instead was undefined.
body.properties.Name.name should be defined, instead was undefined.
body.properties.Name.start should be defined, instead was undefined.

i’m not sure why it isn’t accepting the rich_text i tried to add, and i wasn’t able to make a trigger event to see how a block is formatted : (

disclaimer: this is my first forum post anywhere so i apologise if i’ve been unclear or left anything out! (just comment and i’ll do my best to update the post) i’ve also never programmed in javascript before,i got the rest of the step working by copying an image…any help would be tremendously appreciated!

Hi @snowstarsparkle

First off, welcome to the Pipedream community. Happy to have you!

Thanks for the partial code snippet and the response error from Airtable, that’s very helpful for us to follow along.

I believe the issue is that your description variable might be misreferencing the Google Calendar data.

Here’s a video that might help:

But if you could share how you’re assigning data to the description variable, that would help tremendously!

thank you for the reply! i’m taking the event description from google calendar and slicing off a link at the end, here’s my code above the axios function(?):

const linkLength = 74;   
    const description = steps.trigger.event.description.slice(0,-linkLength); //slices description into content and url
    const link = steps.trigger.event.description.slice(-linkLength);

i tried putting this into a separate node.js step that returned description and link, and they’re both the right strings. here’s some sample data:

steps.trigger.event.description: Please fill out the form!
https://classroom.google.com/c/NDk3MzQ3NDgxNDkz/a/NDk3Mzc3Njg1Nzkz/details

description: Please fill out the form!

link: https://classroom.google.com/c/NDk3MzQ3NDgxNDkz/a/NDk3Mzc3Njg1Nzkz/details

Hi @snowstarsparkle

I believe I see some of the issue now.

You should try using this action in your workflow so you can see the list of expected properties your Database has:

Each property will need a value defined for a new entry.

For example, the default Calendar database example in Notion has 3 properties (Date, Title and Tags)

I assume your database will have different fields.

Just a quick update @snowstarsparkle

I was able to add a Google Calendar event to my Notion Database, but I don’t believe Page title’s support hyperlinks.

Here’s my workflow that you can open and use in your account: https://pipedream.com/new?h=tch_mD7fK3

The workflow sharing feature is experimental, but hopefully that brings in the configuration of the workflow, you’d just need to connect your Google Calendar & Notion accounts.

But the issue is, even if you add a link to the title, it appears that Notion doesn’t render the link markdown: