Update Notion page when a property changes

Is it possible to make changes to a notion property when a certain other property has a specific value? For example can I add a number to one property when another property is marked true? I’ve noticed that the Notion Page Update function seems to only apply to when a property is updated but not when it has a specific value. Am I missing something about how this feature works?

Thanks!

Hi @lifemeanschange7,

To achieve the behavior you’re describing, where a change to one Notion property triggers an update to another property based on specific conditions, you would typically use a Pipedream workflow that:

  1. Triggers when a Notion page is updated.
  2. Checks the value of the specific property you’re interested in.
  3. If the property meets your condition (e.g., it’s marked true), performs an update to another property.

Unfortunately, I don’t have access to live data or the ability to browse external content, so I can’t provide specific details on Notion’s triggers or actions available within Pipedream’s integration. However, I can guide you on how to set up a workflow with a general approach:

  1. Trigger: Use a Notion trigger that fires when a page is updated. This could be a pre-built Notion trigger in Pipedream’s UI.
  2. Condition: Add a code step after the trigger to check the value of the property. If the condition is met (e.g., a checkbox property is true), proceed to the next step.
  3. Action: Use a Notion action or a code step to update the target property on the page.

Here’s a simplified example of how you might write a custom code step in Node.js to check a property and update another property if the condition is met:

import { axios } from "@pipedream/platform";

export default defineComponent({
  props: {
    notion: {
      type: "app",
      app: "notion",
    },
  },
  async run({ steps, $ }) {
    // Assume `steps.trigger.event` contains the updated Notion page data
    const pageId = steps.trigger.event.pageId;
    const checkboxProperty = steps.trigger.event.properties["YourCheckboxProperty"].checkbox;
    const numberProperty = steps.trigger.event.properties["YourNumberProperty"].number;

    // Check if the checkbox property is true
    if (checkboxProperty === true) {
      // Add a number to the number property
      const updatedNumber = numberProperty + 1;

      // Update the Notion page with the new number
      return await axios($, {
        method: "patch",
        url: `https://api.notion.com/v1/pages/${pageId}`,
        headers: {
          "Authorization": `Bearer ${this.notion.$auth.oauth_access_token}`,
          "Notion-Version": " 
  I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! [Learn how to build your own.](https://pipedream.com/blog/using-the-new-openai-actions-in-pipedream/)