Created
May 20, 2021 03:39
-
-
Save dealingwith/99c4da33565dddb115b5c173e1e29f48 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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}`, | |
| "Content-Type": "application/json", | |
| "Notion-Version": "2021-05-13" | |
| } | |
| }) | |
| let bodyContent = await arg('Enter Content') | |
| let {bodyData} = await patch( | |
| `https://api.notion.com/v1/blocks/${data.id}/children`, { | |
| "children": [ | |
| { | |
| "object": "block", | |
| "type": "paragraph", | |
| "paragraph": { | |
| "text": [ | |
| { | |
| "type": "text", | |
| "text": { | |
| "content": bodyContent | |
| } | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| headers: { | |
| Authorization: `Bearer ${notionToken}`, | |
| "Content-Type": "application/json", | |
| "Notion-Version": "2021-05-13" | |
| } | |
| }) | |
| 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