Using Notion with Drafts

I’ve downloaded the example actions but they’re not working. I’ve authenticated everything and shared it with Drafts from Notion but I keep getting error when running an action.

What error details are showing in the action log?

The first one showed “Service login required” which I guess was because I haven’t logged in yet. Following that were a few that showed “Notion: Parent required” and the last few showed “Notion: Content cannot be empty”.

Is this all on a single run, or on multiple runs? Really what you want is the exact log entries of the most recent single run. You should just be able to copy and paste the content of the messages section directly into the forum post.

E.g. Here is a recent error from my log.


Script step completed.
Script step completed.
Script Error: ReferenceError: Can't find variable: strRegExSearch
Line number: 34, Column 21

Oh yeah, here’s the error message from the latest run.

Notion: Content cannot be empty.

Screeshot:
Screen Shot 2022-05-05 at 12.12.25

This message is pretty clear…what is the content of the draft you are trying to run this action on? Per the description, this action takes the first line of the draft as a title, and the remaining lines as to-dos. Do you have multiple lines in your draft? It sounds like it’s trying to create a blank page in Notion, which is not valid.

2 Likes

As you can see from here the drafts page I’m trying to add to Notion is not empty. The Notion page I’m trying to append to as well is not empty page, there’s a lot of text in it. I’ve also tried appending to other pages as well but it’s still not working.

From the screenshot it looks like all of your text might be on the first line, the title - which would mean there is no content beyond the title, which as Greg noted above is what is used for the content sent to Notion.

What do you get with a draft like this? The same error, or does it then work, with lines 2-4 being used as the content?

I am the title line
I am the first content line
...
I am the last content line

Many thanks for creating this integration!

1 Like

Oh, I get it, it’s working now. Seems like because there was no line break it was taking the whole paragraph as a single line. Thanks for the clarification.

This integration is amazing! Is it at all possible to edit the script so that it will send it to Notion and a checkbox property titled “Inbox” will be checked?

If I can do this, I can make sure I have the ability to further process things in Notion like adding required metadata, before I uncheck it and make it live in my workspace. Currently have 8 different databases I’d like to send to with the Inbox checked, I’ll just make 8 duplicate actions and change the ID of each.

Thanks in advance!

1 Like

Hey Joshredd
You can add a line to the database page properties eg: "Inbox": { "checkbox": true }

So constant properties would be as below:

const properties = { 
					"Name": { "title": [ {"text": { "content": title}}]} ,
					
 					 "Inbox":  { "checkbox":  true } 
					};

Inbox being the name of the database checkbox property.

Hope this helps!

which action are you using. On my iphone, when i edit the action, i dont see option to edit the script to add the database ID.

I think the action referred to is this one

Any chance of making this work with just a single line of text being transferred to a page in Notion? Using it for capture and often only have one line that I need to get over and this seems to require a second line or more. I have tried to figure it out in the script but it has yet to work.

Thanks!

In theory possible, but not easy to do. Notion pages are constructed as a series of “children” that are block-level elements. The Notion step and most examples I’ve seen, when appending, add new children to a page.

In order to update a page without having new lines, you would need to be modifying an existing child element rather than adding a new one. The Notion API has method to do that, but, again, it’s not easy - in that you would need to know how to target a specific child, get it’s current content, modify that content, upload a replacement - so there would be a series of required API calls.

Ugh. That is what I was worried about! Ha.

Way above my programming pay grade.

Appreciate the response. Will have to limit my drafts usage a little more then unfortunately.