Skip to content

Repository files navigation

Getting Started with Notion

Introduction

The Notion API allows developers to integrate with Notion workspaces programmatically. Build integrations that connect Notion with other tools, automate workflows, and manage workspace content including pages, databases, blocks, users, comments, and search. Notion is an all-in-one workspace that combines notes, tasks, wikis, and databases into a flexible, collaborative platform.

Requirements

The SDK requires Go version 1.18 or above.

Building

Install Dependencies

Resolve all the SDK dependencies, using the go get command.

Installation

The following section explains how to use the notion library in a new project.

1. Add SDK as a Dependency to the Application

  • Add the following lines to your application's go.mod file:
replace notion => ".\\notion-go_generic_lib" // local path to the SDK

require notion v0.0.0
  • Resolve the dependencies in the updated go.mod file, using the go get command.

Initialize the API Client

Note: Documentation for the client can be found here.

The following parameters are configurable for the API Client:

Parameter Type Description
httpConfiguration HttpConfiguration Configurable http client options like timeout and retries.
loggerConfiguration LoggerConfiguration Represents the logger configurations for API calls
bearerAuthCredentials BearerAuthCredentials The Credentials Setter for OAuth 2 Bearer token

The API client can be initialized as follows:

package main

import (
    "notion"
)

func main() {
    client := notion.NewClient(
    notion.CreateConfiguration(
            notion.WithHttpConfiguration(
                notion.CreateHttpConfiguration(
                    notion.WithTimeout(30),
                ),
            ),
            notion.WithBearerAuthCredentials(
                notion.NewBearerAuthCredentials("AccessToken"),
            ),
            notion.WithLoggerConfiguration(
                notion.WithLevel("info"),
                notion.WithRequestConfiguration(
                    notion.WithRequestBody(true),
                ),
                notion.WithResponseConfiguration(
                    notion.WithResponseHeaders(true),
                ),
            ),
        ),
    )
}

Authorization

This API uses the following authentication schemes.

List of APIs

SDK Infrastructure

Configuration

Utilities

Releases

Packages

Contributors

Languages