This topic was automatically generated from Slack. You can find the original thread here.
Hey I’m trying to set up a workflow that updates Notion pages. I tested each step successfully and deployed it and I get the “Updated page successfully” message. However, the notion pages aren’t updating
Use Case:
When I save a URL to my notion database, it triggers a python script in Pipedream that takes the saved URL, extracts text from it, and updates the relevant notion page properties with the extracted data points
Notion trigger config:
import notion from "../../notion.app.mjs";
import base from "../common/base.mjs";
import constants from "../common/constants.mjs";
export default {
...base,
key: "notion-new-page",
name: "New Page in Database",
description: "Emit new event when a page in a database is created",
version: "0.0.4",
type: "source",
props: {
...base.props,
databaseId: {
propDefinition: [
notion,
"databaseId",
],
},
},
async run() {
const pages = [];
const params = this.lastCreatedSortParam();
const lastCreatedTimestamp = this.getLastCreatedTimestamp();
// Get pages in created order descending until the first page edited after
// lastCreatedTimestamp, then reverse list of pages and emit
const pagesStream = this.notion.getPages(this.databaseId, params);
for await (const page of pagesStream) {
if (!this.isResultNew(page.created_time, lastCreatedTimestamp)) {
break;
}
pages.push(page);
}
pages.reverse().forEach((page) => {
const meta = this.generateMeta(
page,
constants.types.PAGE,
constants.timestamps.CREATED_TIME,
constants.summaries.PAGE_ADDED,
);
this.$emit(page, meta);
});
const lastCreatedTime = pages[pages.length - 1]?.created_time;
if (lastCreatedTime) {
this.setLastCreatedTimestamp(Date.parse(lastCreatedTime));
}
},
};
Thanks . I think the problem is the Property Types , it actually is the property names. So for example, if your notion page has the Asking Price, Cashflow, then your Property Types array should be {{ ["Asking Price", "Cashflow"] }}
My property type values were being exported as strings and they needed to be integers. It was confusing because it was saying the requests was successful