What are the Elements of a Workflow in <http://Pipedream.com|Pipedream.com> that Update Google Tasks Lists from Notion Updates?

I apologize for the ongoing issue. It seems that we might need to take a closer look at the Notion trigger configuration and the Google Tasks setup. To help you better, please provide the following information: 1. The Notion database you’re working with: please share the structure (properties and their types) of the database. 2. The Google Tasks list you’re using: please confirm that it contains tasks with Notion URLs in their notes. Additionally, please double-check that the Notion API key and Google Tasks API configurations are set up correctly in your Pipedream workflow. Once I have this information, I’ll be able to provide more targeted assistance to resolve the issue.

The notion database I’m using’s ID is 1165ab1d5fdb4a88b6bcc45ae0d2d9d7. It’s called “all tasks” and has a ton of properties, but the ones that I’m mainly using are the title, the done check box, “the google task date” The google tasks list is called :spiral_calendar_pad: Reclaim
and it’s ID is Mk1hZng3dVdLeEJ6ZVZqUg

Thank you for providing the additional information. Based on your requirements, I suggest using the “Notion — Query Database” action to fetch the tasks from your Notion database and the “Google Tasks — List Tasks” action to fetch tasks from your Google Tasks list. Here’s a step-by-step guide to set up your workflow: 1. Add the “Notion — Query Database” action to your workflow. 2. Connect your Notion account and select the database ID 1165ab1d5fdb4a88b6bcc45ae0d2d9d7. 3. Configure any filters if needed. 4. Add the “Google Tasks — List Tasks” action to your workflow. 5. Connect your Google account and select the task list ID Mk1hZng3dVdLeEJ6ZVZqUg. After setting up these actions, you can add a code step to compare and update the tasks as needed. If you need further assistance with the code step or any other part of the workflow, please let me know.

The Notion - Query Database action is asking for a filter to configure it. I don’t know what filter to provide. It wants text and/or a custom expression

In the “Notion — Query Database” action, the filter is used to narrow down the results based on specific conditions. You can either provide a text filter or a custom expression to match the properties of the items in your Notion database. For example, if you want to fetch tasks that have the “done” checkbox checked, you can use a custom expression like this: { "property": "done", "checkbox": { "equals": true } } Replace “done” with the name of the checkbox property in your Notion database. To use the “Notion — Query Database” action with this filter: 1. Search for the Notion app from the step menu. 2. Select the “Query Database” action. 3. Connect your Notion account. 4. Select the database ID 1165ab1d5fdb4a88b6bcc45ae0d2d9d7. 5. In the Filter field, paste the custom expression mentioned above. 6. Click “Test” to run the action and test the configuration. This will fetch the tasks with the “done” checkbox checked. You can modify the filter expression based on your requirements.

What if I’d like to query the database with no filter?

If you’d like to query the Notion database without any filters, you can simply leave the “Filter” field empty in the “Notion — Query Database” action. Here’s how to set it up: 1. Search for the Notion app from the step menu. 2. Select the “Query Database” action. 3. Connect your Notion account. 4. Select the database ID 1165ab1d5fdb4a88b6bcc45ae0d2d9d7. 5. Leave the “Filter” field empty. 6. Click “Test” to run the action and test the configuration. This will fetch all the tasks from your Notion database without applying any filters.

The step won’t let me test without adding something in the filter.

I apologize for the confusion. It seems that the “Notion — Query Database” action requires a filter. In this case, you can use a filter that essentially returns all items in the database. You can use a filter based on the “created_time” property, which should be present in all pages: on { "property": "created_time", "created_time": { "after": "1970-01-01T00:00:00Z" } } This filter will return all items created after January 1, 1970, which should include all items in your database. To use this filter in the “Notion — Query Database” action: 1. Search for the Notion app from the step menu. 2. Select the “Query Database” action. 3. Connect your Notion account. 4. Select the database ID 1165ab1d5fdb4a88b6bcc45ae0d2d9d7. 5. In the Filter field, paste the custom expression mentioned above. 6. Click “Test” to run the action and test the configuration. This should fetch all the tasks from your Notion database. If you need further assistance, please let me know.

I got this error: SyntaxError
Unexpected token o in JSON at position 0

I apologize for the confusion earlier. It seems the filter expression I provided was not formatted correctly as a JSON string. Let’s try using a filter expression as a JSON string like this: on { "property": "created_time", "created_time": { "after": "1970-01-01T00:00:00Z" } } To use this filter in the “Notion — Query Database” action: 1. Search for the Notion app from the step menu. 2. Select the “Query Database” action. 3. Connect your Notion account. 4. Select the database ID 1165ab1d5fdb4a88b6bcc45ae0d2d9d7. 5. In the Filter field, paste the JSON string mentioned above. 6. Click “Test” to run the action and test the configuration. This should fetch all the tasks from your Notion database. If you need further assistance, please let me know.

I got a syntax error again: SyntaxError
Unexpected token o in JSON at position 0

I apologize for the confusion earlier. It seems I made a mistake in providing the filter expression. Since you want to query the database without any filters, you can try using the “Notion API” action instead of the “Notion — Query Database” action. Here’s how to set it up: 1. Search for the Notion app from the step menu. 2. Select the “Notion API” action. 3. Connect your Notion account. 4. In the “Endpoint” field, enter databases/1165ab1d5fdb4a88b6bcc45ae0d2d9d7/query. 5. Set the “HTTP Method” to POST. 6. Leave the “Body” field empty. 7. Click “Test” to run the action and test the configuration. This should fetch all the tasks from your Notion database without applying any filters. If you need further assistance, please let me know.

When I did the notion API action, I got this code, and I’m not sure where to enter the things you’re saying to enter:
import { axios } from@pipedream/platform”
export default defineComponent({
props: {
notion: {
type: “app”,
app: “notion”,
}
},
async run({steps, $}) {
return await axios($, {
url: https://api.notion.com/v1/users/me,
headers: {
Authorization: Bearer ${**this**.notion.$auth.oauth_access_token},
“Notion-Version”: 2021-08-16,
},
})
},
})

I apologize for the confusion earlier. Based on the code you provided, it seems you’re using the Notion API action to fetch the user’s information. To query the database without filters, you can modify the code like this: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { notion: { type: "app", app: "notion", }, }, async run({ steps, $ }) { return await axios($, { method: "POST", url: "https://api.notion.com/v1/databases/1165ab1d5fdb4a88b6bcc45ae0d2d9d7/query", headers: { Authorization: `Bearer ${this.notion.$auth.oauth_access_token}`, "Notion-Version": "2021-08-16", "Content-Type": "application/json", }, data: {}, }); }, }); This code will query the Notion database with ID 1165ab1d5fdb4a88b6bcc45ae0d2d9d7 without applying any filters. If you need further assistance, please let me know.

that step seems to be working right now!

I’m glad to hear that the step is working for you now! If you have any more questions or need further assistance, please don’t hesitate to ask.

Now, about the completion step of the workflow: How do I get the logs to not do this? 9/19/2023, 12:34:46 PM
Updated Tasks: []

9/19/2023, 12:34:46 PM
Google Tasks: []

It seems like you want to prevent empty arrays from being logged in your workflow. To achieve this, you can add a conditional statement before logging the output. Here’s an example: if (updatedTasks.length > 0) { console.log(`Updated Tasks: ${JSON.stringify(updatedTasks)}`); } if (googleTasks.length > 0) { console.log(`Google Tasks: ${JSON.stringify(googleTasks)}`); } This code will only log the output if the arrays updatedTasks and googleTasks are not empty. If you need further assistance, please let me know.

Not exactly. I want those arrays to not be empty, so that I can run this code and get my google tasks to mark complete when I mark the notion task as complete. import { axios } from@pipedream/platform”;

export default defineComponent({
props: {
google_tasks: {
type: “app”,
app: “google_tasks”,
},
},
async run({ steps }) {
const updatedTasks = steps.trigger.event.updatedTasks || [];
const tasksData = steps.list_tasks.data;
const tasks = tasksData && tasksData.tasks ? tasksData.tasks : [];

console.log(“Updated Tasks:“, updatedTasks);
console.log(“Google Tasks:“, tasks);

**for** (**const** taskToUpdate **of** updatedTasks) {
  **const** notionUrl = taskToUpdate.notes;
  **const** task = tasks.find((task) => task.notes === notionUrl);

  console.log(“Task to update:“, taskToUpdate);
  console.log(“Matching Google Task:“, task);

  **if** (task) {
    **const** taskId = task.id;
    **const** isCompleted = steps.trigger.event.properties.done.checkbox;

    console.log(“Is completed:“, isCompleted);

    **const** url = `https://www.googleapis.com/tasks/v1/lists/@default/tasks/${taskId}`;
    **const** body = {
      status: isCompleted ? “completed” : “needsAction”,
    };

    **await** axios(**this**, {
      method: “PUT”,
      url: url,
      headers: {
        Authorization: `Bearer ${**this**.google_tasks.$auth.oauth_access_token}`,
        “Content-Type”: “application/json”,
      },
      data: body,
    });
  }
}

},
});