Extract Notion AI Meeting Summaries with Python SDK
The Advanced Use-Case: Automated Insight Distribution
Section titled “The Advanced Use-Case: Automated Insight Distribution”Modern engineering and product teams use Notion AI to transcribe meetings and generate high-level summaries automatically. However, these insights often remain “trapped” within the Notion UI.
An advanced workflow requires moving these AI-generated summaries into external systems—such as posting a meeting recap to a specific Slack channel, updating a Jira ticket with AI-identified action items, or archiving transcripts in a dedicated data warehouse. To do this, we must bridge the gap between Notion’s asynchronous AI processing and the Notion API.
The “Aha!” Solution: Treating AI Properties as Static Data
Section titled “The “Aha!” Solution: Treating AI Properties as Static Data”The secret to accessing Notion AI content via the API lies in understanding how Notion stores AI outputs. Whether it is an AI Summary, AI Key Info, or AI Custom Autofill property, the Notion API treats these as standard rich_text or text fields once the AI has finished its generation task.
The challenge is timing: Notion AI runs asynchronously. If your script triggers the moment a page is created, the AI property will likely be empty. The solution is a Polling Pattern or a Delayed Webhook that queries the page after the last_edited_time indicates the AI has completed its write operation.
Step-by-Step Implementation
Section titled “Step-by-Step Implementation”1. Integration Setup
Section titled “1. Integration Setup”First, ensure your integration has “Read Content” capabilities.
- Navigate to Settings & Members > Connections > Develop or manage integrations.
- Create a new integration or select an existing one.
- Under Capabilities, ensure Read content is checked.
- Copy your Internal Integration Token.
- Go to your Meeting Notes database and click the three dots (…) > Connect to and select your integration.
2. Install the SDK
Section titled “2. Install the SDK”Ensure you have the official Python client installed:
pip install notion-client3. The Retrieval Script
Section titled “3. The Retrieval Script”The following Python script targets a specific database page and extracts both the AI Summary property and the transcript stored within the page blocks.
from notion_client import Clientimport time
notion = Client(auth="your_integration_token")
def get_notion_ai_content(page_id): # Retrieve the page properties page = notion.pages.retrieve(page_id=page_id)
# 1. Accessing an AI Autofill Property (e.g., "AI Summary") # Note: Replace 'AI Summary' with the exact name of your property properties = page.get("properties", {}) ai_summary_data = properties.get("AI Summary", {}).get("rich_text", [])
summary_text = "" if ai_summary_data: summary_text = "".join([t.get("plain_text", "") for t in ai_summary_data])
# 2. Accessing the Transcript (Page Content) blocks = notion.blocks.children.list(block_id=page_id).get("results", [])
transcript = [] for block in blocks: if block["type"] == "paragraph": text_content = block["paragraph"]["rich_text"] if text_content: transcript.append(text_content[0]["plain_text"])
return { "summary": summary_text, "transcript": "\n".join(transcript) }
# Execution with a simple retry logic to account for AI latencypage_id = "your_page_id_here"content = get_notion_ai_content(page_id)
if not content["summary"]: print("AI is still thinking... Retrying in 10 seconds.") time.sleep(10) content = get_notion_ai_content(page_id)
print(f"Summary: {content['summary']}")Data Structure Requirements
Section titled “Data Structure Requirements”When the Notion API returns an AI-generated property, it follows the rich_text JSON structure. Your application should be prepared to parse the following schema:
| Key | Type | Description |
|---|---|---|
properties |
Object | Root object containing all page metadata. |
AI Summary |
Object | The custom name of your AI Autofill property. |
rich_text |
Array | An array of text objects (AI outputs are stored here). |
plain_text |
String | The actual string value generated by Notion AI. |
Required JSON Response Structure from Notion API:
{ "properties": { "AI Summary": { "id": "abc123", "type": "rich_text", "rich_text": [ { "type": "text", "text": { "content": "The meeting covered the Q4 roadmap...", "link": null }, "plain_text": "The meeting covered the Q4 roadmap...", "annotations": { "bold": false, "italic": false } } ] } }}Edge Cases & Limitations
Section titled “Edge Cases & Limitations”- Generation Latency: Notion AI takes 5–30 seconds to populate properties after a transcript is added. Implement a “Wait” step in your automation (e.g., using a tool like Zapier or a Python
time.sleep) or verify thelast_edited_byis the Notion AI “system user.” - Property Mapping: If you change the name of the “AI Summary” column in the UI to “Key Insights,” your Python code must be updated to match the new key.
- Transcript Length: If the transcript is extremely long, it will be split across multiple blocks. You must iterate through
notion.blocks.children.listusing thestart_cursorparameter to ensure you capture the full text. - Permissions: If the integration was added to the database before the AI properties were created, you may need to re-share the page or refresh the connection to ensure the API can see the new property schemas.