Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mavera.io/llms.txt

Use this file to discover all available pages before exploring further.

Scenario

Before a meeting, AEs need account intelligence — what the company does, recent news, competitive landscape. Pipedrive stores the org record but lacks depth. Mave Agent researches each organization and returns a cited intelligence brief.

Architecture

Code

import os, requests

DOMAIN = os.environ["PIPEDRIVE_DOMAIN"]
PD_TOKEN = os.environ["PIPEDRIVE_API_TOKEN"]
PD_BASE = f"https://{DOMAIN}.pipedrive.com"
MAVERA_KEY = os.environ["MAVERA_API_KEY"]

def pd_get(path, params=None):
    params = params or {}
    params["api_token"] = PD_TOKEN
    r = requests.get(f"{PD_BASE}{path}", params=params)
    r.raise_for_status()
    return r.json()

# 1. Pull organizations
orgs = pd_get("/api/v2/organizations", {"limit": 20, "sort_by": "update_time", "sort_direction": "desc"}).get("data", []) or []

# 2. Research each with Mave Agent
for org in orgs[:10]:
    name = org.get("name", "Unknown")
    addr = org.get("address", "")
    query = (
        f"Research '{name}'{f' based in {addr}' if addr else ''}. "
        f"Analyze: (1) business model, (2) recent news, (3) competitive landscape, "
        f"(4) strategic initiatives, (5) pain points for B2B SaaS. Cite sources."
    )
    mave = requests.post(
        "https://app.mavera.io/api/v1/mave/chat",
        headers={"Authorization": f"Bearer {MAVERA_KEY}"},
        json={"message": query},
    )
    mave.raise_for_status()
    result = mave.json()
    print(f"\n{'='*50}\nAccount: {name} | Sources: {len(result.get('sources', []))}")
    print(result.get("content", "")[:500])

    # 3. Write brief back as Pipedrive note
    requests.post(
        f"{PD_BASE}/api/v1/notes",
        params={"api_token": PD_TOKEN},
        json={
            "content": f"<b>Account Intelligence Brief</b><br><br>{result.get('content', '')[:3000]}",
            "org_id": org["id"],
            "pinned_to_organization_flag": 1,
        },
    )

Example Output

Account: Acme Manufacturing Inc. | Sources: 4

Business Model: Acme produces industrial automation components for
automotive. Revenue ~$450M (2024 10-K).

Recent News: Announced $30M expansion into EV battery assembly tooling
(Reuters, Jan 2026). Hired new CTO from Siemens in Q4 2025.

Competitive Landscape: Fanuc, ABB Robotics, Rockwell Automation.
Acme differentiates on customization speed.

Pain Points: Legacy ERP integration, manual quality reporting,
scaling engineering for EV pivot. Receptive to workflow automation.

Error Handling

ErrorCauseFix
Mave returns generic contentOrg name too commonAdd industry, location, or website to disambiguate
429 from MaveToo many concurrent requestsProcess orgs sequentially with 1-2s delay
Note creation failsOrg deleted or permissions issueVerify org exists; check token write scope