Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Notion integration for investigation reports and incident tracking #286

@davincios

Description

@davincios

Goal

Let OpenSRE post investigation reports to Notion and track incidents in a Notion database. When an investigation completes, the agent should be able to create or update a Notion page with the structured findings — root cause, evidence, timeline, and suggested actions.

Background

Teams already use Notion as a knowledge base for runbooks, postmortems, and incident logs. Today, investigation results live in the terminal or get manually copied into docs. A Notion integration closes that gap: every investigation automatically becomes a searchable, shareable page that the whole team can reference.

Notion's API supports creating pages in databases, appending block content, and querying existing pages — all of which map well to OpenSRE's investigation output.

Scope

New integration: Notion

  1. Integration config — Add NotionIntegrationConfig to app/integrations/models.py with api_key and database_id fields. Wire into EffectiveIntegrations.

  2. Client — Add app/integrations/clients/notion/client.py wrapping the Notion API:

    • create_page(database_id, title, properties, content_blocks) — creates a new page in the target database
    • append_blocks(page_id, blocks) — appends content blocks to an existing page
    • query_database(database_id, filter) — queries for existing incident pages (dedup, linking)
  3. Investigation tool — Add NotionCreateReportTool under app/tools/NotionCreateReportTool/:

    • Takes the investigation summary, root cause, evidence list, and severity
    • Creates a structured Notion page with sections for each
    • Returns the Notion page URL for reference
    • Register in app/tools/investigation_registry/actions.py
  4. Wizard integration — Add Notion to the optional integrations in app/cli/wizard/flow.py:

    • Prompt for Notion Internal Integration Token
    • Prompt for target database ID (or offer to list accessible databases)
    • Validate the token against the Notion API
    • Persist via sync_env_values (NOTION_API_KEY, NOTION_DATABASE_ID)
    • Store via upsert_integration
  5. Verify support — Add notion to SUPPORTED_VERIFY_SERVICES in app/integrations/verify.py.

Environment variables:

  • NOTION_API_KEY — Notion internal integration token
  • NOTION_DATABASE_ID — Default database for investigation reports

Done when

  • opensre onboard offers Notion as an optional integration and validates the token
  • opensre verify notion confirms connectivity
  • The NotionCreateReportTool is available to the investigation agent
  • After an investigation, the agent can create a Notion page with the full report
  • Duplicate investigations update existing pages rather than creating new ones
  • make lint && make typecheck pass
  • Unit tests cover the Notion client and tool

Reference

  • Integration models: app/integrations/models.py
  • Integration store: app/integrations/store.py
  • Existing client pattern: app/integrations/clients/grafana/, app/integrations/clients/datadog/
  • Tool base class: app/tools/base.py
  • Tool registry: app/tools/investigation_registry/actions.py
  • Wizard flow: app/cli/wizard/flow.py
  • Env sync: app/cli/wizard/env_sync.py
  • Verify CLI: app/integrations/verify.py
  • Notion API docs: https://developers.notion.com/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions