How do I add an entry to a Notion Database?

Hi, I am trying to add an entry to a specific Notion database with the trigger as Google Calendar New Event created. However, I cannot find any databases in the Parent ID “Select an option” list. Is there anyway to add an entry to a database, and not just a regular notion page?

And also, how would I be able to match the start and end event time of a calendar event to certain columns/properties of the new database entry?

Appreciate your help
Eric

Hey Eric,

I’ve done my fair share of playing around with the Pipedream Notion actions. Have you shared the Pipedream integration with the main page of the database you’re trying to update with the Google Calendar New Event?

Tully

Thanks for helping me out Tully. Upon connecting notion to pipedream, I gave it access to all the “Pages” in my workspace. The database I wanted to add to is nested within one of the shared pages. I was able to see my database in a different action, I believe in the Query Database action. I was planning to look into using javascript to accomplish this if possible?

Kind regards,
Eric

Hi Eric. You can use the custom Notion API action and write something like this into the “Code” portion of the action. You’ll need to identify the “database_id” and then you’ll have to build your properies schema so that it matches your Notion database schema. Then you can map the data from the Google Calendar New Event to the properties which you define.

Hi all, I’m trying this code and getting 400 errors.

async run({steps, $}) {
    return await axios($, {
      method: 'POST',
      url: `https://api.notion.com/v1/pages`,
      headers: {
        Authorization: `Bearer ${this.notion.$auth.oauth_access_token}`,
        "Notion-Version": `2022-02-22`,
      },
      data:{
        parent:{ 
          'database-id': "mydatabase id "
        },
        properties:{
          "Name": {
		      	"title": [
                  {
                    "text": {
                      "content": "SomeTest"
                             }
                  }
		  	            ]
		            }
        }
      }
    })
  },
})

@mikesheinin can you share additional data on the 400 error you’re getting?

Hi, I resolved my problem the issue was with TYPO in a few places. Now the code is:

{
      
      url: `https://api.notion.com/v1/pages`,
      headers: {
        Authorization: `Bearer ${this.notion.$auth.oauth_access_token}`,
        "Notion-Version": `2022-02-22`,
      },
      method: 'POST',
      data: {
        parent:{ 
          database_id: <DBID>
        },
        properties:{
          Name:{
            title:[{text: {content: steps.trigger.event.email.subject}}]
          },
          'Task Status':{
                select: {
                   name: 'NEW',
                },
          }
		    },
         children: [
             {
              object: 'block',
              type: 'heading_2',
              heading_2: {
              rich_text: [
                      {
                        type: 'text',
                        text: { content: 'EMAIL CONTENT' , },
                      },
                        ],
                      },
                },
            {
              object: 'block',
              type: 'paragraph',
              paragraph: {
                rich_text: [
                    {
                    type: 'text',
                    text: { content: steps.trigger.event.email.bodyPreview},
                    }
                ]
              }
            } 
          ]
      }
    })
  },

I don’t suppose you’d be willing to share your workflow? I’ve been trying to get this working but have been having some issues. I tried using the code you showed here but it didn’t seem to help, so I can only assume I’m missing something elsewhere maybe