Connectors
Pages · Databases
provider="notion"

Connect Notion

Let your Python automations read and update the Notion pages and databases each person chooses to share, through your own public Notion integration.

· Setup essentials; a full guide is on its way

The notion preset connects through a public integration, Notion's name for an OAuth app. Notion doesn't use scopes: when someone connects, they pick which pages and databases to share with your integration, and a run can only see those.

Declare the connection

import requests

from callables import Connection, Group

notion = Connection("notion", provider="notion")
docs = Group("notion", title="Notion", connections=[notion])


@docs.deploy(title="Find pages")
def find_pages(query: str) -> list[dict]:
    """Searches the pages you shared with this integration."""
    resp = requests.post("https://api.notion.com/v1/search",
                         headers={"Authorization": f"Bearer {notion.token}", "Notion-Version": "2022-06-28"},
                         json={"query": query, "filter": {"property": "object", "value": "page"}})
    resp.raise_for_status()
    return [{"id": p["id"], "url": p["url"]} for p in resp.json()["results"]]

notion.account is the name of the workspace the person connected.

Set up the integration

  1. At notion.so/profile/integrations, create a new integration and choose the Public type. Only public integrations can use OAuth.
  2. Add the redirect URI https://callables.app/connections/callback. Notion asks for some details about your company for a public integration, such as a website.
  3. Copy the OAuth client ID and OAuth client secret into your project's secrets as NOTION_CLIENT_ID and NOTION_CLIENT_SECRET, or the names you give client_id=Secret(...) and client_secret=Secret(...).

To test with call connect, also add http://localhost:8765/callback as a redirect URI. If Notion won't accept it, test from the web app instead.

A full step-by-step Notion guide is on its way. Until then, the connections docs cover how connections work.

Run your scripts on each person's own account

Declare a connection, push, and share. Everyone connects once and every run uses their account.

Read the connections docs

Other connectors