Skip to content

Instantly share code, notes, and snippets.

@dealingwith
Last active June 1, 2021 00:47
Show Gist options
  • Save dealingwith/24ccf1b94413168939eff0369a25bd9f to your computer and use it in GitHub Desktop.
Save dealingwith/24ccf1b94413168939eff0369a25bd9f to your computer and use it in GitHub Desktop.
let notionToken = await env('NOTION_USER_TOKEN')
let databaseID = "3859b567fda3464ea5a69d5ccb56274b"
let {data} = await post(
`https://api.notion.com/v1/databases/${databaseID}/query`,
{
"filter":
{
"property": "Status",
"select": {
"is_empty": true
}
},
page_size: 50
},
{
headers: {
Authorization: `Bearer ${notionToken}`,
"Content-Type": "application/json",
"Notion-Version": "2021-05-13"
}
})
let tasks = data.results
let task = tasks[Math.floor(Math.random() * tasks.length)];
let pageID = task.id.replace(/-/g, "");
let pageURL = `https://notion.so/${databaseID}?p=${pageID}`
copy(pageURL)
await focusTab(pageURL, "Google Chrome Beta")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment