加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.js 898 Bytes
一键复制 编辑 原始数据 按行查看 历史
httishere 提交于 2021-08-19 14:49 . fix
/*
* @Author: your name
* @Date: 2021-08-19 13:45:46
* @LastEditTime: 2021-08-19 14:37:23
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /notion/index.js
*/
// import { Client } from "@notionhq/client"
var { Client } = require('@notionhq/client')
const notion = new Client({ auth: process.env.NOTION_KEY })
const databaseId = process.env.NOTION_DATABASE_ID
async function addItem(text) {
try {
const response = await notion.pages.create({
parent: { database_id: databaseId },
properties: {
title: {
title:[
{
"text": {
"content": text
}
}
]
}
},
})
console.log(response)
console.log("Success! Entry added.")
} catch (error) {
console.error(error.body)
}
}
addItem("Yurts in Big Sur, California")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化