<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Safwan Shaheer</title>
    <description>The latest articles on Forem by Safwan Shaheer (@devorein).</description>
    <link>https://forem.com/devorein</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F60081%2F77b93a6b-6499-45ad-be1c-f889230555c5.jpg</url>
      <title>Forem: Safwan Shaheer</title>
      <link>https://forem.com/devorein</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/devorein"/>
    <language>en</language>
    <item>
      <title>Auto-populate your Github readme with data fetched from a remote notion database.</title>
      <dc:creator>Safwan Shaheer</dc:creator>
      <pubDate>Tue, 04 May 2021 16:44:16 +0000</pubDate>
      <link>https://forem.com/devorein/auto-populate-your-github-readme-with-data-fetched-from-a-remote-notion-database-2ca9</link>
      <guid>https://forem.com/devorein/auto-populate-your-github-readme-with-data-fetched-from-a-remote-notion-database-2ca9</guid>
      <description>&lt;p&gt;Hello everyone. This article will share how I managed to auto-populate a Github readme learned section using data fetched from a remote notion database using a GitHub action that I created using Typescript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Devorein/github-readme-learn-section-notion" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  In Repository File
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Add the following content to your &lt;code&gt;README.md&lt;/code&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## What I have learned so far&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!--START_SECTION:learn--&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!--END_SECTION:learn--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Configure the workflow
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Github&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Readme&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Updater'&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*'&lt;/span&gt; &lt;span class="c1"&gt;# Runs Every Day&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;update_learn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Update&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;learn&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;section'&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Fetching&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Repository&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Contents'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@main&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Learn&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Section&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Updater'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;devorein/github-readme-learn-section-notion@master'&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;database_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;6626c1ebc5a44db78e3f2fe285171ab7'&lt;/span&gt;
          &lt;span class="na"&gt;token_v2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.NOTION_TOKEN_V2 }}&lt;/span&gt; &lt;span class="c1"&gt;# Required only if your database is private&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;TIP&lt;/strong&gt;: You can test out using &lt;a href="https://www.notion.so/devorein/6c46c1ebc5a44db78e3f5fe285071ab6?v=0bc36e7c59e54f34b0838956e35b4490" rel="noopener noreferrer"&gt;this template&lt;/a&gt; that I've created just for this purpose.&lt;/p&gt;

&lt;h3&gt;
  
  
  In your notion account
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Create a full-page database
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620140790011%2FZSlkgNHas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620140790011%2FZSlkgNHas.png" alt="Notion Full Page Database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Your database must maintain the following structure/schema&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620141419086%2FHQVjtExaB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620141419086%2FHQVjtExaB.png" alt="Notion Table Schema Options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Get the id of the database
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620140795651%2FPhdNBZEQH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620140795651%2FPhdNBZEQH.png" alt="Notion Full Page Database Id"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Add it in the workflow file
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;database_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;6626c1ebc5a44db78e3f2fe285171ab7'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the rest of the steps only if your database is not public, if its public you don't need to set the token_v2&lt;/p&gt;

&lt;h4&gt;
  
  
  To make your database public
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the database in your notion account&lt;/li&gt;
&lt;li&gt;Click on Share at the top right corner&lt;/li&gt;
&lt;li&gt;Click on the Share to Web button.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  1. Get your notion &lt;code&gt;token_v2&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: By no means should you share or expose your notion &lt;code&gt;token_v2&lt;/code&gt;. If you feel like you've done so accidentally, immediately log out from that account in all of your devices.&lt;/p&gt;

&lt;p&gt;Follow the steps below to obtain your &lt;code&gt;token_v2&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open up the dev tools of your preferred browser.&lt;/li&gt;
&lt;li&gt;Go to the Application &amp;gt; Cookies section.&lt;/li&gt;
&lt;li&gt;There you'll find a &lt;code&gt;token_v2&lt;/code&gt; cookie.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Its highly recommended to store your &lt;code&gt;token_v2&lt;/code&gt; as a github secret rather than pasting it in your workflow file.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Create a github secret to store &lt;code&gt;token_v2&lt;/code&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;navigate to the url &lt;code&gt;https://github.com/&amp;lt;USERNAME&amp;gt;/&amp;lt;REPO-NAME&amp;gt;/settings/secrets/actions&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;New repository secret&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;You can name your secret as anything you want&lt;/li&gt;
&lt;li&gt;Paste the &lt;code&gt;token_v2&lt;/code&gt; value in the &lt;code&gt;Value&lt;/code&gt; textarea&lt;/li&gt;
&lt;li&gt;Use the secret in your workflow file
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;token_v2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.NOTION_TOKEN_V2 }}&lt;/span&gt; &lt;span class="c1"&gt;# The secret was named NOTION_TOKEN_V2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Outcome
&lt;/h3&gt;

&lt;p&gt;If you follow all the steps properly your readme should look something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620140780727%2Fqz4TAzMgV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620140780727%2Fqz4TAzMgV.png" alt="Github Readme Learn Section"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this was helpful to you. That's all from me for now.&lt;/p&gt;

&lt;p&gt;The code for the Github action is &lt;a href="https://github.com/Devorein/github-readme-learn-section-notion" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Feel free to submit a pull request or open a new issue, contributions are highly appreciated and more than welcome. Thank you for reading.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>notion</category>
      <category>actions</category>
      <category>automation</category>
    </item>
    <item>
      <title>Open source ts based unofficial notion API</title>
      <dc:creator>Safwan Shaheer</dc:creator>
      <pubDate>Thu, 17 Dec 2020 13:32:02 +0000</pubDate>
      <link>https://forem.com/devorein/open-source-ts-based-unofficial-notion-api-3342</link>
      <guid>https://forem.com/devorein/open-source-ts-based-unofficial-notion-api-3342</guid>
      <description>&lt;p&gt;Nishan is an open-source notion API built with typescript, axios, and node to automate almost all the CRUD functionalities the notion client provides by itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reasons
&lt;/h2&gt;

&lt;p&gt;As an avid notion user and a front end developer, I've always wanted to automate a lot of my workflow using Notion's native API. I have a pretty complex setup that requires a lot of manual steps, which me being a developer just could not consider as an option.&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;When I started looking for the API I was a bit surprised to find that there is none, at least by the official notion team, but plenty of open-source ones, and very few for javascript where I am most comfortable. Unfortunately, most of them supported only reading data but lacked other CRUD features. So, I decided to build one from scratch using Axios as the HTTP client and javascript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stack
&lt;/h3&gt;

&lt;p&gt;Writing it in plain JS seemed like a good idea initially, (as I never could have imagined I would be working on this library for over a month). But soon enough it got really out of hand and I ran into errors here and there. The most frustrating was the manual testing. I had to manually test whether all of the API worked properly or not, which was really not that fun. Finally, I believe after 2 weeks into it I decided to convert the whole project into typescript and never looked back.&lt;/p&gt;

&lt;h3&gt;
  
  
  Process
&lt;/h3&gt;

&lt;p&gt;The first few days were incredibly rough. I had no idea what to do as I've never done something like this ever before. But after dabbling with the notion client for a bit, seeing each request that happens when I do something in the client and analyzing the headers, I began to grasp it little by little, and after a month of work, I am proud to say that while it's definitely not gonna have all the features of the native API, it does provide a lot.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Optimal caching to reduce unnecessary requests&lt;/li&gt;
&lt;li&gt;CRUD features for all types of data eg Space, User, Page, Block, etc etc&lt;/li&gt;
&lt;li&gt;Easy to use API providing methods for almost everything&lt;/li&gt;
&lt;li&gt;Minimal setup (you only require your notion token)&lt;/li&gt;
&lt;li&gt;Types to represent almost everything within notion&lt;/li&gt;
&lt;li&gt;An internal stack to batch operations and send a single request to the server with the appropriate payload.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Please note that this library has not been published as an npm package yet as I feel the API is still constantly evolving. So you have to clone the repo to use it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Nishan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./dist&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nishan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Nishan&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* Paste your copied token here, you can obtain it from devtools &amp;gt; Application &amp;gt; Cookies &amp;gt; notion.so &amp;gt; token_v2 */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="cm"&gt;/* Timeout between each request */&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// Get the notion user using predicate&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;nishan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getNotionUser&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;given_name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Safwan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Get the workspace using predicate&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;space&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getSpace&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;space&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;space&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;`Developer`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Get the root pages from the selected workspace based on the predicate&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;troot_pages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;space&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getTRootPages&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;troot_page&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;troot_page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;troot_page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;My Page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Delete the root page&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;troot_pages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;})()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just a glimpse of what is possible with Nishan, I've tried to add CRUD methods for everything required (apart from a few I'm currently working on).&lt;/p&gt;

&lt;h2&gt;
  
  
  Disclaimer
&lt;/h2&gt;

&lt;p&gt;This is still a project in progress and the docs do require a lot of love. Although the API is pretty much fixed it might change drastically in the future. Please use this library with caution as you might end up manipulating your notion data in irreversible ways. Also, be on the lookout for the official API as that will definitely be a lot better than what I've managed myself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I know my work will become invalidated within a couple of months when the official API comes out, but this journey was a lot of fun plus I learned a ton from it. It would be wonderful if you could check it out. Any sort of feedback and suggestions is more than welcome. Thank you and have fun automating, cheers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Nishan-Open-Source/Nishan"&gt;Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nishan-docs.netlify.app/"&gt;Doc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>notionapi</category>
      <category>typescript</category>
      <category>axios</category>
      <category>notion</category>
    </item>
  </channel>
</rss>
