Recientemente hice una integración entre Todoist y Notion. La idea principal es que cada vez que hago algo con una tarea en Todoist, los cambios se reflejan en Notion. Tengo un problema con la función notion.pages.update() : cada vez que modifico una tarea, devuelve este error: 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. Ni siquiera tengo una propiedad de body en mi base de datos.
Aquí está mi función de actualización, tenga en cuenta que esta es una función dentro de un módulo que hice:
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 !== {}; }¡Cualquier ayuda es muy apreciada!
Creo que su propiedad Nombre debería verse así:
Name: { title: [ { text: { content: name } } ] }Puede verlo aquí en los documentos: https://developers.notion.com/reference/patch-page
Lo resolví, el problema en realidad estaba en otra función (la función getProject )