Links
Comment on page

Add icon image to page

Tags: #notion #productivity #naas_drivers #operations #snippet
Author: Maxime Jublou​
Last update: 2023-04-12 (Created: 2022-06-30)
Description: This notebook allows users to add an icon image to a Notion page.

Input

Import libraries

from naas_drivers import notion

Setup Notion

# Enter Token API
NOTION_TOKEN = "ENTER_YOUR_NOTION_TOKEN_HERE" # EXAMPLE: "secret_xxxxxxxxxxxxxxxxxx"
​
# Enter Page URL
PAGE_URL = "ENTER_YOUR_PAGE_URL_HERE" # EXAMPLE: "https://www.notion.so/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
​
# Enter icon URL
IMAGE_URL = "ENTER_YOUR_IMAGE_URL_HERE" # EXAMPLE: "https://XXXXXXXXXXXX.png"

Model

Get page

page = notion.connect(NOTION_TOKEN).page.get(PAGE_URL)

Add icon image to page

notion.client.pages.update(
page_id=page.id, icon={"type": "external", "external": {"url": IMAGE_URL}}
)

Output

page.update()