Skip to main content

Scenario

Your team maintains competitive intelligence in a Notion wiki — feature comparisons, pricing snapshots, win/loss notes, and market positioning. This data is goldmine for sales but trapped in static pages. This job pulls competitive pages, enriches them through Mave Agent’s research capabilities, then generates structured battle cards with the Generate endpoint. The result is always-fresh, AI-enriched battle cards that combine your internal intel with public information. Flow: Notion POST /databases/{id}/query (competitive wiki) → Extract pages → Mavera POST /api/v1/mave/chat (enrich each competitor) → POST /api/v1/generations → Battle card documents

Code

Example Output

Error Handling

Competitive wikis have inconsistent schemas. The code tries Name, Title, and Competitor properties. If your title property has a different name, adjust the extraction logic.
Mave Agent’s research reflects its latest available data. For time-sensitive competitive intelligence (e.g., a pricing change announced today), supplement with the Notion wiki’s internal observations.
Writing battle card pages back to Notion requires the database schema to support the properties you’re setting. If your competitive wiki has required properties beyond Name, the create call will fail with a 400 error.
This job makes 3 API calls per competitor (Notion read + Mave + Generate + optional Notion write). For 10 competitors, that’s ~30+ calls. The 1-second delay between competitors keeps you within Notion’s 3 req/sec limit.