Open utterances-bot opened 2 weeks ago
How are you able to run:
const response = await notion.databases.query({
database_id: NOTION_DATABASE_ID,
filter: {
property: "Title",
text: {
equals: "Circe",
},
},
})
console.log(response)
})()
I get the error "SyntaxError: await is only valid in async functions and the top level bodies of modules" even though I'm running Node.js v20.12.0. I tried adding
{ "type": "module" }
to package.json to no avail.
Good catch! I just updated the post with a functional version, it works if you wrap it in an async function like this:
async function exportHighlights() {
const response = await notion.databases.query({
database_id: NOTION_DATABASE_ID,
filter: {
property: "Title",
rich_text: {
equals: "Circe",
},
},
})
console.log(response)
}
exportHighlights()
How to export Kobo highlights to Notion with Node and better-sqlite3 · julia rodenburg
Using the Notion API and better-sqlite3 to export Kobo highlights to Notion.
https://www.juliariec.com/blog/export-kobo-to-notion/