Skip to content

Instantly share code, notes, and snippets.

@dealingwith
Created May 20, 2021 03:38
Show Gist options
  • Save dealingwith/d8e701f2e0e5e64cb820103af96a08d2 to your computer and use it in GitHub Desktop.
Save dealingwith/d8e701f2e0e5e64cb820103af96a08d2 to your computer and use it in GitHub Desktop.
let notionToken = await env('NOTION_USER_TOKEN')
let databaseID = "3859b567fda3464ea5a69d5ccb56274b"
let content = await arg('Enter Task')
let {data} = await post(
'https://api.notion.com/v1/pages', {
"parent": { "database_id": databaseID },
"properties": {
"Name": {
"title": [
{
"text": {
"content": content
}
}
]
}
}
},
{
headers: {
Authorization: `Bearer ${notionToken}`,
}
})
let pageID = data.id.replace(/-/g, "");
let pageURL = `https://notion.so/${databaseID}?p=${pageID}`
copy(pageURL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment