Last active
June 1, 2021 00:47
-
-
Save dealingwith/24ccf1b94413168939eff0369a25bd9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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