How Can I Use Google Tasks to Find Matching Information?

To match Google Tasks to Notion tasks based on the Google Tasks notes and the Notion private URL, you can follow these steps: 1. Retrieve the Google Tasks and their notes. 2. Query the Notion database and retrieve the pages with their private URLs. 3. Iterate through the Google Tasks and find the corresponding Notion page based on the notes and private URL match. 4. Perform the desired action (e.g., update, sync, etc.) on the matched tasks. Here’s a code snippet to help you with this process: ```
import { google } from “googleapis”; import { Client as NotionClient } from “@notionhq/client”; export default defineComponent({ props: { google_tasks: { type: “app”, app: “google_tasks”, }, notion: { type: “app”, app: “notion”, }, notion_db_id: { type: “string”, label: “Notion Database ID”, }, tasklist_id: { type: “string”, label: “Google Tasks List ID”, }, }, async run({ $ }) { const googleTasks = google.tasks({ version: “v1”, auth: this.google_tasks.$auth.oauth_access_token, }); const response = await googleTasks.tasks.list({ tasklist: this.tasklist_id, }); const googleTasksItems = response.data.items; const notionClient = new NotionClient({ auth: this.notion.$auth.oauth_access_token, }); const notionResponse = await notionClient.databases.query({ database_id: this.notion_db_id, }); const notionPages = notionResponse.results; for (const task of googleTasksItems) { const taskNote = task.notes; const matchedPage = notionPages.find( (page) => page.url === taskNote ); if (matchedPage) { // Perform the desired action on the matched tasks // For example, update the Notion page or sync data between Google Tasks and Notion } } return “Tasks matched!”; }, });

I have a step in my workflow that I’m trying to have configured to get the task ids and titles from google tasks and return them in an array. The step before that is a google tasks Lists_tasks step, so I thought i’d be able to take the path from the results on that step. but that doesn’t seem to be working. Here is the code from the step I’m trying use:

import { axios } from "@pipedream/platform"
export default defineComponent({
  props: {
    google_tasks: {
      type: "app",
      app: "google_tasks",
   },
    taskListId: {
      type: "string",
      label: "Task List ID",
    },
    taskId: {
      type: "string",
      label: "Task ID",
    },
  },
  async run({ steps, $ }) {
    const url = `https://www.googleapis.com/tasks/v1/lists/${this.taskListId}/tasks/${this.taskId}`;
    const response = await axios($, {
      url,
      headers: {
        Authorization: `Bearer ${this.google_tasks.$auth.oauth_access_token}`,
      },
    });

    return {
      id: response.id,
      title: response.title,
      notes: response.notes,
      completed: response.completed,
      due: response.due,
    };
  },
});

It looks like you’re trying to get task IDs and titles from Google Tasks and return them in an array. However, the current code is only fetching a single task based on the taskId prop. To fetch all tasks in a task list and return their IDs and titles in an array, you can modify the code like this: ```
import { google } from “googleapis”; export default defineComponent({ props: { google_tasks: { type: “app”, app: “google_tasks”, }, taskListId: { type: “string”, label: “Task List ID”, }, }, async run({ steps, $ }) { const googleTasks = google.tasks({ version: “v1”, auth: this.google_tasks.$auth.oauth_access_token, }); const response = await googleTasks.tasks.list({ tasklist: this.taskListId, }); const googleTasksItems = response.data.items; const tasksArray = googleTasksItems.map((task) => { return { id: task.id, title: task.title, }; }); return tasksArray; }, });

Can I test my workflow with I’ve exceeded my daily credits?

You should visit https://pipedream.com/pricing for the latest pricing, but I’ll do my best to answer. Once you’ve exceeded your daily credits on the free tier, you won’t be able to run your workflow until your credits reset at 00:00 (midnight) UTC. If you need more credits, you can consider upgrading to a paid plan, which doesn’t have a daily credit limit. You can find more information on pricing and plans at https://pipedream.com/pricing.

So, I used the following code but the error says, Error
Login Required. DETAILS

    at Gaxios._request (/tmp/__pdg__/dist/code/537fcbfe5904666ed7916e2afeac991eac0e8a3405ac0754317d6a77b8b8391a/node_modules/.pnpm/gaxios@6.1.1/node_modules/gaxios/build/src/gaxios.js:141:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.run (file:///tmp/__pdg__/dist/code/537fcbfe5904666ed7916e2afeac991eac0e8a3405ac0754317d6a77b8b8391a/component.mjs:20:22)
    at null.executeComponent (/var/task/launch_worker.js:229:22)
    at MessagePort.messageHandler (/var/task/launch_worker.js:726:28)
import { google } from "googleapis";

export default defineComponent({
  props: {
    google_tasks: {
      type: "app",
      app: "google_tasks",
    },
    taskListId: {
      type: "string",
      label: "Task List ID",
    },
  },
  async run({ steps, $ }) {
    const googleTasks = google.tasks({
      version: "v1",
      auth: this.google_tasks.$auth.oauth_access_token,
    });

    const response = await googleTasks.tasks.list({
      tasklist: this.taskListId,
    });

    const googleTasksItems = response.data.items;

    const tasksArray = googleTasksItems.map((task) => {
      return {
        id: task.id,
        title: task.title,
      };
    });

    return tasksArray;
  },
});

I apologize for the inconvenience you’re experiencing. The error you’re encountering indicates that there might be an issue with the authentication. Please ensure that you’ve connected your Google Tasks account correctly in the Pipedream UI. If you’ve already connected your account and are still facing this issue, please try reconnecting your Google Tasks account to ensure the OAuth access token is valid. If the problem persists, feel free to reach out to Pipedream support at https://pipedream.com/support for further assistance.