Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
Encountered error while updating pages in a database with Notion API

I recently made an integration between Todoist and Notion. The main idea is that every time I do something with a task on Todoist, the changes are reflected on Notion. I'm encountering a problem with the notion.pages.update() function: every time I modify a task, it returns this 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. I don't even have a body property in my database.

Here's my update function, keep in mind that this is a function inside a module I made:

    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 !== {};
    }

Any help is highly appreciated!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I think your Name property should look like this:

Name: {
    title: [
        {
            text: { content: name }
        }
    ]
}

You can see that here in the docs: https://developers.notion.com/reference/patch-page

about 4 years ago · Juan Pablo Isaza Relatório

0

I solved it, the problem was actually in another function (the getProject function)

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda