Update a Notion Page's properties

Hello,

I’m stuck with a bug on my Notion to Todoist workflow. It’s probably very basic but I’m not making progress so your help would be handy.

Here is my workflow : when a new page is created in a particular db in Notion then a task is created in Todoist and the id of that task is added to the Notion page’s appropriate property

I’m stuck with the last part.

The error message suggests the expression I’ve set is not a string… why?
This lingo is a bit obscure to me…

Should I have used a Set Node between the Todoist Node and the 2nd Notion Node ?
I’ve tried but I don’t understand Set Nodes yet, the way I set them up seem redundant.

Best,
BaptisteB

Hey @BaptisteB, it looks you’re receiving a numeric value from Todoist but Notion is expecting a text value.

Seeing your expression is {{$node["Todoist"].json["id"]}}, could you try appending .toString() to it? Or in other words, use an expression of {{$node["Todoist"].json["id"].toString()}}? This would apply some Javascript magic to force the numeric value into a text type which Notion hopefully accepts.

Thank you @MutedJam!
I managed to figure out about an hour ago that changing the type of field in Notion from text to number would do the trick.

Javascript comes in handy though and I might need some similar magic to go the other way around, from string to number.

In a similar workflow, heading the opposite direction, I need to search a db for a specific number (the Todoist task id incremented in the previous workflow discussed above) in the page properties of my Notion db.
This time around, when I set up a get all Notion Node I get an error because my ‘number’ expression apparently is a string.

I tried adding .parseInt() as well as .Number() .toNumber(), but I’m a bit a a loss here.
Could you please tell me how to turn the following expression into a number ?

{{$node["Webhook"].json["body"]["event_data"]["id"]}}

parseInt() is a great idea but works slightly different from .toString(). Could you try {{parseInt($node["Webhook"].json["body"]["event_data"]["id"])}}? This should return a number:
image
image

In n8n’s JSON view you can easily differentiate numbers and strings btw which might help with quickly checking the results. Strings will have double quotes " around them, numbers won’t have these):
image

Thank you!
I see that my syntax wasn’t right.
Not quite sure what’s causing the error but neither the string nor the number seem to be accepted.

When I use ParseInt() I get this

And when I use toString() I get this

What I am suppose to feed Notion I not strings nor numbers do you reckon?