Wrote rudimentary creation of Notion pages with title and body
This commit is contained in:
parent
b3fe8075f5
commit
876c74ba41
83
index.js
83
index.js
|
|
@ -8,27 +8,66 @@ const notion = new Client({auth: process.env.NOTION_TOKEN});
|
||||||
const joplinNotebookID = process.env.JOPLIN_NOTEBOOK_ID;
|
const joplinNotebookID = process.env.JOPLIN_NOTEBOOK_ID;
|
||||||
const notionDatabaseID = process.env.NOTION_DATABASE_ID;
|
const notionDatabaseID = process.env.NOTION_DATABASE_ID;
|
||||||
|
|
||||||
// async function addItem(text) {
|
|
||||||
// try {
|
// essentially a main function
|
||||||
// const response = await notion.pages.create({
|
async function processNotes() {
|
||||||
// parent: {database_id: databaseID},
|
const data = await joplin.getNotesFromNotebook(joplinNotebookID, ["title", "body", "created_time", "updated_time"])
|
||||||
// properties: {
|
for (let note of data) {
|
||||||
// title: {
|
addPageToNotionDatabase(notionDatabaseID, note.title, note.body)
|
||||||
// title: [
|
}
|
||||||
// {
|
}
|
||||||
// "text": {
|
|
||||||
// "content": text
|
processNotes()
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ]
|
async function addPageToNotionDatabase(databaseID, title, body) {
|
||||||
// }
|
try {
|
||||||
// },
|
const response = await notion.pages.create({
|
||||||
// })
|
parent: {database_id: databaseID},
|
||||||
// console.log(response);
|
properties: {
|
||||||
// console.log("Success! Entry added.");
|
title: {
|
||||||
// } catch (error) {
|
title: [
|
||||||
// console.error(error.body);
|
{
|
||||||
// }
|
"type": "text",
|
||||||
// }
|
"text": {
|
||||||
|
"content": title,
|
||||||
|
"link": null
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"bold": false,
|
||||||
|
"italic": false,
|
||||||
|
"strikethrough": false,
|
||||||
|
"underline": false,
|
||||||
|
"code": false,
|
||||||
|
"color": "default"
|
||||||
|
},
|
||||||
|
"plain_text": "Grocery List",
|
||||||
|
"href": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
object: "block",
|
||||||
|
type: "paragraph",
|
||||||
|
paragraph: {
|
||||||
|
"rich_text": [
|
||||||
|
{
|
||||||
|
"text": {
|
||||||
|
"content": body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
console.log(response);
|
||||||
|
console.log("Success! Entry added.");
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// addItem("Yurts in Big Sur, California");
|
// addItem("Yurts in Big Sur, California");
|
||||||
Loading…
Reference in New Issue