How Can I Successfully Use ChatGPT to Update Google Task List When Updating Tasks in Notion?

This topic was automatically generated from Slack. You can find the original thread here.

Hi anyone that can help. I’ve been trying to use chatgpt to create code, but it doesn’t seem to be working.
Here’s my workflow: I’m trying to update my google tasks lists when I update my tasks in notion. (I’m using Thomas Frank’s Ultimate Brain for reference). It consists of these elements

  1. A Notion trigger named “Updated Page in Database” emits an event when a page in your Notion database is updated.
  2. A Google Tasks action named “list_tasks” retrieves the tasks from my Google Tasks list. These are the inputs for that step: Google Tasks Account Google Tasks LiveIntegrity | Task List :spiral_calendar_pad: Reclaim ************************** | Max Results 200 | Show Completed true | *Show Deleted false
    • I also use reclaim.ai’s Google task integration. It removes anything in parenthesis from the title of the task after it’s imported into Google Tasks, so an exact match of the title won’t work to search through the tasks in order to sync due dates or completion status. I’m thinking about matching the first 7 letters to make a partial match of the title or something like that.
    Any ideas or help would be incredible. I’ve been trying to figure this out for weeks, but I don’t know the first thing about coding, so I’m just doing what the bots tell me.
    So, here’s the code I’ve been working with that I can’t get to work right.
import { axios } from "@pipedream/platform";

export default {
  props: {
    google_tasks: {
      type: "app",
      app: "google_tasks",
    },
    task_list_id: {
      type: "string",
      label: "Task List ID",
      default: "Mk1hZng3dVdLeEJ6ZVZqUg",
    },
    notion_due_date: {
      type: "string",
      label: "Notion Due Date",
    },
    notion_page_url: {
      type: "string",
      label: "Notes",
    },
  },
  async run({ steps, $ }) {
    try {
      console.log("Starting the component...");

      const taskDueDate = new Date(this.notion_due_date);
      if (isNaN(taskDueDate.getTime())) {
        console.error("Invalid date value");
        return;
      }
      const isoDueDate = taskDueDate.toISOString();

      // Debugging: Log HTTP request to Google Tasks API
      console.log("HTTP Request to Google Tasks API:", {
        method: "GET",
        url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
        headers: {
          Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
        },
      });

      const response = await axios(this, {
        method: "GET",
        url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
        headers: {
          Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
        },
      });

      try {
        if (response.data) {
          console.log("Google Tasks Response:", response.data);
          const tasksArray = response.data.items;
          if (tasksArray && tasksArray.length > 0) {
            const existingTask = tasksArray.find((task) => {
              // Customize this logic to identify an existing task based on the first 7 characters of the title
              const existingTitle = task.title.slice(0, 7);
              const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7);
  
              return existingTitle === newTitle;
            });

            if (existingTask) {
              console.log("Found existing task:", existingTask);
              const taskId = existingTask.id;

              try {
                const updateResponse = await axios(this, {
                  method: "PATCH",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: {
                    due: isoDueDate,
                    notes: this.notion_page_url,
                  },
                });

                console.log("Update response:", updateResponse.data);
              } catch (error) {
                console.error("Error updating task:", taskId, error.response ? error.response.data : error);
              }
            } else {
              console.log("Task not found. Creating a new task...");
              // Create a new task in Google Tasks
              const newTask = {
                title: steps.trigger.event.properties.Task.title[0].plain_text,
                due: isoDueDate,
                notes: this.notion_page_url,
              };

              try {
                const createResponse = await axios(this, {
                  method: "POST",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: newTask,
                });

                console.log("New task created:", createResponse.data);
              } catch (error) {
                console.error("Error creating task:", error.response ? error.response.data : error);
              }
            }
          }
        } else {
          console.log("Google Tasks Response is empty.");
        }
      } catch (responseError) {
        console.error("Error in Google Tasks API response:", responseError);
      }

      console.log("Completed the component successfully.");
    } catch (error) {
      console.error("Error in the component:", error);
    }
  },
};

: Can you help?

Of course! I’m here to help you with any Pipedream-related questions. Please provide more details about your question or issue, and I’ll do my best to assist you.

: Please look at the post from @U05QP4Y16CD above and provide some assistance.

I’m sorry, but I don’t see any specific information or question related to Pipedream in your previous message. Could you please provide more details about your issue or question? This will help me better understand your needs and provide the appropriate assistance.

I tried. :sweat_smile:

Thanks ! I tried with @U05A7KLNALC , but there must be a limit on how much text it can provide. It keeps getting cut off when it extracts code for me.

I apologize for any inconvenience you’ve experienced. To better assist you, could you please provide more details about the issue you’re facing? Which specific Pipedream component or functionality are you working with? This information will help me understand your needs and provide the appropriate assistance.

Hi anyone that can help. I’ve been trying to use chatgpt to create code, but it doesn’t seem to be working.
Here’s my workflow: I’m trying to update my google tasks lists when I update my tasks in notion. (I’m using Thomas Frank’s Ultimate Brain for reference). It consists of these elements

  1. A Notion trigger named “Updated Page in Database” emits an event when a page in your Notion database is updated.
  2. A Google Tasks action named “list_tasks” retrieves the tasks from my Google Tasks list. These are the inputs for that step: Google Tasks Account Google Tasks LiveIntegrity | Task List :spiral_calendar_pad: Reclaim ************************** | Max Results 200 | Show Completed true | *Show Deleted false
    • I also use reclaim.ai’s Google task integration. It removes anything in parenthesis from the title of the task after it’s imported into Google Tasks, so an exact match of the title won’t work to search through the tasks in order to sync due dates or completion status. I’m thinking about matching the first 7 letters to make a partial match of the title or something like that.
    Any ideas or help would be incredible. I’ve been trying to figure this out for weeks, but I don’t know the first thing about coding, so I’m just doing what the bots tell me.
    So, here’s the code I’ve been working with that I can’t get to work right.
import { axios } from "@pipedream/platform";

export default {
  props: {
    google_tasks: {
      type: "app",
      app: "google_tasks",
    },
    task_list_id: {
      type: "string",
      label: "Task List ID",
      default: "Mk1hZng3dVdLeEJ6ZVZqUg",
    },
    notion_due_date: {
      type: "string",
      label: "Notion Due Date",
    },
    notion_page_url: {
      type: "string",
      label: "Notes",
    },
  },
  async run({ steps, $ }) {
    try {
      console.log("Starting the component...");

      const taskDueDate = new Date(this.notion_due_date);
      if (isNaN(taskDueDate.getTime())) {
        console.error("Invalid date value");
        return;
      }
      const isoDueDate = taskDueDate.toISOString();

      // Debugging: Log HTTP request to Google Tasks API
      console.log("HTTP Request to Google Tasks API:", {
        method: "GET",
        url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
        headers: {
          Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
        },
      });

      const response = await axios(this, {
        method: "GET",
        url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
        headers: {
          Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
        },
      });

      try {
        if (response.data) {
          console.log("Google Tasks Response:", response.data);
          const tasksArray = response.data.items;
          if (tasksArray && tasksArray.length > 0) {
            const existingTask = tasksArray.find((task) => {
              // Customize this logic to identify an existing task based on the first 7 characters of the title
              const existingTitle = task.title.slice(0, 7);
              const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7);
  
              return existingTitle === newTitle;
            });

            if (existingTask) {
              console.log("Found existing task:", existingTask);
              const taskId = existingTask.id;

              try {
                const updateResponse = await axios(this, {
                  method: "PATCH",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: {
                    due: isoDueDate,
                    notes: this.notion_page_url,
                  },
                });

                console.log("Update response:", updateResponse.data);
              } catch (error) {
                console.error("Error updating task:", taskId, error.response ? error.response.data : error);
              }
            } else {
              console.log("Task not found. Creating a new task...");
              // Create a new task in Google Tasks
              const newTask = {
                title: steps.trigger.event.properties.Task.title[0].plain_text,
                due: isoDueDate,
                notes: this.notion_page_url,
              };

              try {
                const createResponse = await axios(this, {
                  method: "POST",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: newTask,
                });

                console.log("New task created:", createResponse.data);
              } catch (error) {
                console.error("Error creating task:", error.response ? error.response.data : error);
              }
            }
          }
        } else {
          console.log("Google Tasks Response is empty.");
        }
      } catch (responseError) {
        console.error("Error in Google Tasks API response:", responseError);
      }

      console.log("Completed the component successfully.");
    } catch (error) {
      console.error("Error in the component:", error);
    }
  },
};

I see that you’re trying to update your Google Tasks lists when you update your tasks in Notion. I’ll help you with the code to achieve this. First, let’s set up a Notion trigger and a Google Tasks action in your workflow. 1. Add the “Updated Page in Database” Notion trigger to your workflow and configure it with your Notion account and database. 2. Add a “Run Node.js code” action step after the Notion trigger, and use the following code: ``` import { axios } from “@pipedream/platform”; export default defineComponent({ props: { google_tasks: { type: “app”, app: “google_tasks”, }, task_list_id: { type: “string”, label: “Task List ID”, default: “Mk1hZng3dVdLeEJ6ZVZqUg”, }, }, async run({ steps, $ }) { const notionTaskTitle = steps.trigger.event.properties.Task.title[0].plain_text; const notionDueDate = steps.trigger.event.properties[“Due Date”].date.start; const notionPageUrl = steps.trigger.event.url; const taskDueDate = new Date(notionDueDate); if (isNaN(taskDueDate.getTime())) { console.error(“Invalid date value”); return; } const isoDueDate = taskDueDate.toISOString(); const response = await axios(this, { method: “GET”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, }, }); const tasksArray = response.data.items; const existingTask = tasksArray.find((task) => { const existingTitle = task.title.slice(0, 7); const newTitle = notionTaskTitle.slice(0, 7); return existingTitle === newTitle; }); if (existingTask) { const taskId = existingTask.id; await axios(this, { method: “PATCH”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, “Content-Type”: “application/json”, }, data:

can you see what’s wrong with my code?

I’d be happy to help you with your code, but I’ll need to see the code you’re referring to. Please provide the code snippet or a description of the issue you’re facing, and I’ll do my best to assist you.

this is the code…
Here’s my workflow: I’m trying to update my google tasks lists when I update my tasks in notion. (I’m using Thomas Frank’s Ultimate Brain for reference). It consists of these elements

  1. A Notion trigger named “Updated Page in Database” emits an event when a page in your Notion database is updated.
  2. A Google Tasks action named “list_tasks” retrieves the tasks from my Google Tasks list. These are the inputs for that step: Google Tasks Account Google Tasks LiveIntegrity | Task List :spiral_calendar_pad: Reclaim ************************** | Max Results 200 | Show Completed true | *Show Deleted false
    • I also use reclaim.ai’s Google task integration. It removes anything in parenthesis from the title of the task after it’s imported into Google Tasks, so an exact match of the title won’t work to search through the tasks in order to sync due dates or completion status. I’m thinking about matching the first 7 letters to make a partial match of the title or something like that.
    So, here’s the code I’ve been working with that I can’t get to work right.
import { axios } from "@pipedream/platform";

export default {
  props: {
    google_tasks: {
      type: "app",
      app: "google_tasks",
    },
    task_list_id: {
      type: "string",
      label: "Task List ID",
      default: "Mk1hZng3dVdLeEJ6ZVZqUg",
    },
    notion_due_date: {
      type: "string",
      label: "Notion Due Date",
    },
    notion_page_url: {
      type: "string",
      label: "Notes",
    },
  },
  async run({ steps, $ }) {
    try {
      console.log("Starting the component...");

      const taskDueDate = new Date(this.notion_due_date);
      if (isNaN(taskDueDate.getTime())) {
        console.error("Invalid date value");
        return;
      }
      const isoDueDate = taskDueDate.toISOString();

      // Debugging: Log HTTP request to Google Tasks API
      console.log("HTTP Request to Google Tasks API:", {
        method: "GET",
        url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
        headers: {
          Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
        },
      });

      const response = await axios(this, {
        method: "GET",
        url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
        headers: {
          Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
        },
      });

      try {
        if (response.data) {
          console.log("Google Tasks Response:", response.data);
          const tasksArray = response.data.items;
          if (tasksArray && tasksArray.length > 0) {
            const existingTask = tasksArray.find((task) => {
              // Customize this logic to identify an existing task based on the first 7 characters of the title
              const existingTitle = task.title.slice(0, 7);
              const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7);
  
              return existingTitle === newTitle;
            });

            if (existingTask) {
              console.log("Found existing task:", existingTask);
              const taskId = existingTask.id;

              try {
                const updateResponse = await axios(this, {
                  method: "PATCH",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: {
                    due: isoDueDate,
                    notes: this.notion_page_url,
                  },
                });

                console.log("Update response:", updateResponse.data);
              } catch (error) {
                console.error("Error updating task:", taskId, error.response ? error.response.data : error);
              }
            } else {
              console.log("Task not found. Creating a new task...");
              // Create a new task in Google Tasks
              const newTask = {
                title: steps.trigger.event.properties.Task.title[0].plain_text,
                due: isoDueDate,
                notes: this.notion_page_url,
              };

              try {
                const createResponse = await axios(this, {
                  method: "POST",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: newTask,
                });

                console.log("New task created:", createResponse.data);
              } catch (error) {
                console.error("Error creating task:", error.response ? error.response.data : error);
              }
            }
          }
        } else {
          console.log("Google Tasks Response is empty.");
        }
      } catch (responseError) {
        console.error("Error in Google Tasks API response:", responseError);
      }

      console.log("Completed the component successfully.");
    } catch (error) {
      console.error("Error in the component:", error);
    }
  },
};

I see that you’re trying to update your Google Tasks lists when you update your tasks in Notion. I noticed a few issues in your code that might be causing problems. Here’s an updated version of your code with some fixes: ``` import { axios } from “@pipedream/platform”; export default { props: { google_tasks: { type: “app”, app: “google_tasks”, }, task_list_id: { type: “string”, label: “Task List ID”, default: “Mk1hZng3dVdLeEJ6ZVZqUg”, }, notion_due_date: { type: “string”, label: “Notion Due Date”, }, notion_page_url: { type: “string”, label: “Notes”, }, }, async run({ steps, $ }) { try { console.log(“Starting the component…”); const taskDueDate = new Date(this.notion_due_date); if (isNaN(taskDueDate.getTime())) { console.error(“Invalid date value”); return; } const isoDueDate = taskDueDate.toISOString(); const response = await axios(this, { method: “GET”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, }, }); try { if (response.data) { console.log(“Google Tasks Response:”, response.data); const tasksArray = response.data.items; if (tasksArray && tasksArray.length > 0) { const existingTask = tasksArray.find((task) => { const existingTitle = task.title.slice(0, 7); const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7); return existingTitle === newTitle; }); if (existingTask) { console.log(“Found existing task:”, existingTask); const taskId = existingTask.id; try { const updateResponse = await axios(this, { method: “PATCH”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token},

it looks like your code wasn’t finalized. Is there anything else you’d like to add?

Apologies for the incomplete code earlier. Here’s the finalized version of the code: ``` import { axios } from “@pipedream/platform”; export default { props: { google_tasks: { type: “app”, app: “google_tasks”, }, task_list_id: { type: “string”, label: “Task List ID”, default: “Mk1hZng3dVdLeEJ6ZVZqUg”, }, notion_due_date: { type: “string”, label: “Notion Due Date”, }, notion_page_url: { type: “string”, label: “Notes”, }, }, async run({ steps, $ }) { try { console.log(“Starting the component…”); const taskDueDate = new Date(this.notion_due_date); if (isNaN(taskDueDate.getTime())) { console.error(“Invalid date value”); return; } const isoDueDate = taskDueDate.toISOString(); const response = await axios(this, { method: “GET”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, }, }); try { if (response.data) { console.log(“Google Tasks Response:”, response.data); const tasksArray = response.data.items; if (tasksArray && tasksArray.length > 0) { const existingTask = tasksArray.find((task) => { const existingTitle = task.title.slice(0, 7); const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7); return existingTitle === newTitle; }); if (existingTask) { console.log(“Found existing task:”, existingTask); const taskId = existingTask.id; try { const updateResponse = await axios(this, { method: “PATCH”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, “Content-Type”: “application/json”, }, data: { due: isoDueDate, notes: this.notion_page_url,

I used this code, but I got an unexpected token error.

import { axios } from "@pipedream/platform";
export default {
 props: {
   google_tasks: {
     type: "app",
     app: "google_tasks",
   },
   task_list_id: {
     type: "string",
     label: "Task List ID",
     default: "Mk1hZng3dVdLeEJ6ZVZqUg",
   },
   notion_due_date: {
     type: "string",
     label: "Notion Due Date",
   },
   notion_page_url: {
     type: "string",
     label: "Notes",
   },
 },
 async run({ steps, $ }) {
   try {
     console.log("Starting the component...");
     const taskDueDate = new Date(this.notion_due_date);
     if (isNaN(taskDueDate.getTime())) {
       console.error("Invalid date value");
       return;
     }
     const isoDueDate = taskDueDate.toISOString();
     const response = await axios(this, {
       method: "GET",
       url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks,
       headers: {
         Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token},
       },
     });
     try {
       if (response.data) {
         console.log("Google Tasks Response:", response.data);
         const tasksArray = response.data.items;
         if (tasksArray && tasksArray.length > 0) {
           const existingTask = tasksArray.find((task) => {
             const existingTitle = task.title.slice(0, 7);
             const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7);
             return existingTitle === newTitle;
           });
           if (existingTask) {
             console.log("Found existing task:", existingTask);
             const taskId = existingTask.id;
             try {
               const updateResponse = await axios(this, {
                 method: "PATCH",
                 url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId},
                 headers: {
                   Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token},
				},
     });
     try {
       if (response.data) {
         console.log("Google Tasks Response:", response.data);
         const tasksArray = response.data.items;
         if (tasksArray && tasksArray.length > 0) {
           const existingTask = tasksArray.find((task) => {
             const existingTitle = task.title.slice(0, 7);
             const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7);
             return existingTitle === newTitle;
           });
           if (existingTask) {
             console.log("Found existing task:", existingTask);
             const taskId = existingTask.id;
             try {
               const updateResponse = await axios(this, {
                 method: "PATCH",
                 url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId},
                 headers: {
                   Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token},
                   "Content-Type": "application/json",
                 },
                 data: {
                   due: isoDueDate,
                   notes: this.notion_page_url,
								};
								try {
                const createResponse = await axios(this, {
                  method: "POST",
                  url: `https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks`,
                  headers: {
                    Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
                    "Content-Type": "application/json",
                  },
                  data: newTask,
                });

                console.log("New task created:", createResponse.data);
              } catch (error) {
                console.error("Error creating task:", error.response ? error.response.data : error);
              }
            }
          }
        } else {
          console.log("Google Tasks Response is empty.");
        }
      } catch (responseError) {
        console.error("Error in Google Tasks API response:", responseError);
      }

      console.log("Completed the component successfully.");
    } catch (error) {
      console.error("Error in the component:", error);
    }
  },
};

I noticed some issues with your code, specifically with the usage of angle brackets < and > around URLs, and some misplaced closing brackets. Here’s the corrected version of your code: ``` import { axios } from “@pipedream/platform”; export default { props: { google_tasks: { type: “app”, app: “google_tasks”, }, task_list_id: { type: “string”, label: “Task List ID”, default: “Mk1hZng3dVdLeEJ6ZVZqUg”, }, notion_due_date: { type: “string”, label: “Notion Due Date”, }, notion_page_url: { type: “string”, label: “Notes”, }, }, async run({ steps, $ }) { try { console.log(“Starting the component…”); const taskDueDate = new Date(this.notion_due_date); if (isNaN(taskDueDate.getTime())) { console.error(“Invalid date value”); return; } const isoDueDate = taskDueDate.toISOString(); const response = await axios(this, { method: “GET”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, }, }); if (response.data) { console.log(“Google Tasks Response:”, response.data); const tasksArray = response.data.items; if (tasksArray && tasksArray.length > 0) { const existingTask = tasksArray.find((task) => { const existingTitle = task.title.slice(0, 7); const newTitle = steps.trigger.event.properties.Task.title[0].plain_text.slice(0, 7); return existingTitle === newTitle; }); if (existingTask) { console.log(“Found existing task:”, existingTask); const taskId = existingTask.id; try { const updateResponse = await axios(this, { method: “PATCH”, url: https://tasks.googleapis.com/tasks/v1/lists/${this.task_list_id}/tasks/${taskId}, headers: { Authorization: Bearer ${this.google_tasks.$auth.oauth_access_token}, “Content-Type”: “application/json”, }, data

Instead of trying to watch for all of the changes in Notion’s data in one code, would it be better to build separate steps - one for an updated due date and a separate one for creating and adding notes to google tasks?

Yes, it would be better to separate the steps for handling updated due dates and creating/adding notes to Google Tasks. This will make your workflow more modular and easier to maintain. You can use Notion triggers like “Page or Subpage Updated” or “Updated Page in Database” to watch for changes in Notion’s data. Then, based on the changes, you can use separate actions to update the due dates and create/add notes to Google Tasks. This way, your workflow will be more organized and easier to debug if needed.