> ## 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.

# Pipedrive

> Integrate Mavera with Pipedrive — pipeline voice analysis, activity-based persona scoring, lost deal focus groups, and org-level account research

## Overview

These jobs show how to **pull data from Pipedrive** (Deals, Notes, Activities, Organizations) → **analyze with Mavera** (Chat, Focus Group, Mave Agent) → **get persona-validated insights** for sales coaching, pipeline optimization, and account intelligence.

<Info>
  **Pipedrive API v2** is the primary API used below. Some endpoints (Notes) still use v1. Authenticate with an **OAuth 2.0 token** or an **API token** query parameter.
</Info>

| Detail              | Value                                                   |
| ------------------- | ------------------------------------------------------- |
| **Base URL**        | `https://{companydomain}.pipedrive.com/api/v2/`         |
| **Auth**            | OAuth 2.0 Bearer token *or* `?api_token=` query param   |
| **Rate limits**     | 30,000 base tokens/day (each request costs 1–10 tokens) |
| **Mavera surfaces** | Chat, Focus Group, Mave Agent                           |

***

## Prerequisites

<Steps>
  <Step title="Pipedrive credentials">
    Generate an API token from **Settings → Personal preferences → API**, or set up an OAuth 2.0 app.
  </Step>

  <Step title="Mavera API key">
    Grab your key from [app.mavera.io/settings/api](https://app.mavera.io/settings/api).
  </Step>

  <Step title="Environment variables">
    ```bash theme={"dark"}
    export PIPEDRIVE_API_TOKEN="pd_tok_..."
    export PIPEDRIVE_DOMAIN="yourcompany"
    export MAVERA_API_KEY="mvr_..."
    ```
  </Step>

  <Step title="Install dependencies">
    <CodeGroup>
      ```bash Python theme={"dark"}
      pip install requests openai
      ```

      ```bash JavaScript theme={"dark"}
      npm install openai
      ```
    </CodeGroup>
  </Step>
</Steps>

***

## Jobs

<CardGroup cols={2}>
  <Card title="Pipeline Stage Voice Analysis" icon="chart-line" href="/integrations/pipedrive/pipeline-stage-voice">
    Analyze deal notes by pipeline stage to find messaging patterns that correlate with wins
  </Card>

  <Card title="Activity-Based Persona Scoring" icon="users" href="/integrations/pipedrive/activity-persona-scoring">
    Map activity patterns (calls, emails, meetings) to buyer personas and discover touchpoint thresholds
  </Card>

  <Card title="Lost Deal Focus Group" icon="magnifying-glass" href="/integrations/pipedrive/lost-deal-focus-group">
    Create persona archetypes from lost-deal patterns and run Focus Groups to surface qualitative reasoning
  </Card>

  <Card title="Org-Level Account Research" icon="building" href="/integrations/pipedrive/org-account-research">
    Use Mave Agent to research organizations and write intelligence briefs back to Pipedrive
  </Card>
</CardGroup>

***

## Production Tips

<AccordionGroup>
  <Accordion title="Paginate large datasets">
    Pipedrive v2 endpoints use cursor pagination. Read `additional_data.next_cursor` from each response:

    ```python theme={"dark"}
    cursor = None
    all_deals = []
    while True:
        params = {"limit": 100}
        if cursor:
            params["cursor"] = cursor
        resp = pd_get("/api/v2/deals", params)
        all_deals.extend(resp.get("data", []) or [])
        cursor = resp.get("additional_data", {}).get("next_cursor")
        if not cursor:
            break
    ```
  </Accordion>

  <Accordion title="Webhook-driven automation">
    Use Pipedrive webhooks (**Settings → Webhooks**) to trigger jobs when deals change stage, are lost, or organizations update. This reduces daily token consumption.
  </Accordion>

  <Accordion title="Normalize lost_reason before clustering">
    Freetext reasons create sparse clusters. Map synonyms before Focus Group:

    ```python theme={"dark"}
    REASON_MAP = {
        "too expensive": "Pricing", "price": "Pricing", "budget": "Pricing",
        "competitor": "Competitor", "went with": "Competitor",
        "timing": "Timing", "not now": "Timing", "next quarter": "Timing",
    }
    def normalize(raw):
        for kw, cat in REASON_MAP.items():
            if kw in raw.lower().strip():
                return cat
        return "Other"
    ```
  </Accordion>
</AccordionGroup>

***

## Credits

| Mavera surface | Credits/call | Typical usage                        |
| -------------- | ------------ | ------------------------------------ |
| Chat           | \~1–5        | Per-stage voice analysis             |
| Focus Group    | \~10–30      | Activity scoring, lost deal analysis |
| Mave Agent     | \~5–15       | Org research                         |

See [Credits](/guides/credits) for details.

***

<CardGroup cols={2}>
  <Card title="Close CRM" icon="phone" href="/integrations/close-crm">
    Email A/B testing, call analysis, lead-to-persona automation
  </Card>

  <Card title="Salesforce" icon="cloud" href="/integrations/salesforce">
    8 jobs — lead scoring, deal-stage focus groups, account research
  </Card>

  <Card title="HubSpot" icon="envelope-open" href="/integrations/hubspot">
    8 jobs — lifecycle personas, meeting analysis, engagement refinement
  </Card>

  <Card title="Integrations" icon="plug" href="/integrations">
    All integrations
  </Card>
</CardGroup>
