我最近在 Todoist 和 Notion 之间进行了集成。主要思想是,每次我在 Todoist 上执行任务时,更改都会反映在 Notion 上。我遇到了notion.pages.update()
函数问题:每次修改任务时,它都会返回此错误:
body failed validation. Fix one: body.properties.body.id should be defined, instead was undefined. body.properties.body.name should be defined, instead was undefined. body.properties.body.start should be defined, instead was undefined.
我的数据库中什至没有body
属性。
这是我的更新功能,请记住,这是我制作的模块中的一个功能:
my.updateTask = async function(notion_page_id, name, todoist_project_id, do_date, priority, in_discord) {
var req_body = {
page_id: notion_page_id,
properties: {
Name: {
type: "title",
title: [
{
type: "rich_text",
rich_text: {
content: name
}
}
],
},
Project: {
type: "relation",
relation: [
{
database_id: my.getProject("todoist_id", todoist_project_id).notion_id
}
]
},
Priority: {
number: priority
},
isOnDiscord: {
checkbox: in_discord
}
}
}
if(typeof do_date !== 'undefined' && do_date !== null) {
start_dt = new Date(do_date.date);
end_dt = new Date(do_date.date);
end_dt.setHours(end_dt.getHours() + 24);
req_body.properties.DoDate = {
date: {
start: start_dt.toISOString().replace(/Z$/, '+02:00'),
end: end_dt.toISOString().replace(/Z$/, '+02:00')
}
}
}
const response = await my.api.pages.update(req_body);
return response !== {};
}
非常感谢任何帮助!