Introduction
Getting started
ZIO Notion is a library that allow user to interact with Notion in a functional way. Under the hood, the library uses STTP, Circe and ZIO to communicate with the Notion API. Thus, we tend to follow the Notion API spec as much as possible.
To install the library, add the following line to your build.sbt:
libraryDependencies += "io.univalence" %% "zio-notion" % "0.9.2"
You will need to create a Notion integration to use this library. You can rapidly create one integration for free at https://www.notion.so/my-integrations. When it is done, you should retrieve the Internal Integration Token provided by Notion. When you have the token you can then start to use the library by creating the live layer such as:
import zio._
import zio.notion._
val notionLayer: Layer[Throwable, Notion] = Notion.layerWith("6A074793-D735-4BF6-9159-24351D239BBC")
caution
We advise you to use zio-config to insert the token. This token can be used by malicious people, to access your Notion data !
If you are not comfortable with ZIO's layers, we advise you to read this documentation.
When it is done, you can start interacting with the Notion API:
import zio._
import zio.notion._
val retrievePageId: ZIO[Notion, NotionError, String] = Notion.retrievePage("page-id").map(_.id)
Feel free to read the Tutorials
section for examples on how to use zio-notion
or visit the
examples directory on github.