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

Close stores call recordings with metadata (duration, direction, user). You want to transcribe recordings and feed them into Mave Agent for structured meeting analysis: decisions made, objections raised, next steps promised, and coaching insights.

Architecture

Code

import os, requests
from requests.auth import HTTPBasicAuth
from openai import OpenAI

CLOSE_KEY = os.environ["CLOSE_API_KEY"]
CLOSE_AUTH = HTTPBasicAuth(CLOSE_KEY, "")
MAVERA_KEY = os.environ["MAVERA_API_KEY"]

def close_get(path, params=None):
    r = requests.get(f"https://api.close.com/api/v1{path}", auth=CLOSE_AUTH, params=params or {})
    r.raise_for_status()
    return r.json()

# 1. Pull calls with recordings
calls = [c for c in close_get("/activity/call/", {"_limit": 50}).get("data", []) if c.get("recording_url")]
if not calls:
    print("No calls with recordings found.")
    exit()

call = calls[0]

# 2. Download and transcribe via Whisper
audio = requests.get(call["recording_url"], auth=CLOSE_AUTH)
audio.raise_for_status()
audio_path = "/tmp/close_call.mp3"
with open(audio_path, "wb") as f:
    f.write(audio.content)

whisper = OpenAI(api_key=os.environ.get("OPENAI_API_KEY", ""))
with open(audio_path, "rb") as af:
    transcription = whisper.audio.transcriptions.create(model="whisper-1", file=af, response_format="text")
transcript = transcription if isinstance(transcription, str) else transcription.text

# 3. Feed to Mave Agent
mave = requests.post(
    "https://app.mavera.io/api/v1/mave/chat",
    headers={"Authorization": f"Bearer {MAVERA_KEY}"},
    json={"message": (
        f"Analyze this sales call transcript. Extract:\n"
        f"1. Key decisions made\n2. Objections raised\n"
        f"3. Next steps and commitments\n4. Coaching insights for the rep\n"
        f"5. Call quality score (1-10)\n\n"
        f"Duration: {call.get('duration', 'unknown')}s | Direction: {call.get('direction', 'unknown')}\n\n"
        f"Transcript:\n{transcript[:8000]}"
    )},
)
mave.raise_for_status()
print(f"Call Analysis for {call.get('phone', 'unknown')}")
print(f"Duration: {call.get('duration', 0)}s\n")
print(mave.json().get("content", "")[:1000])

Example Output

Call Analysis for +1-555-0192 | 1847s

**Decisions:** Prospect agreed to technical deep-dive (next Thursday).
Budget deferred to Q2 planning.

**Objections:** (1) "Locked into 2-year contract" — handled well.
(2) "No bandwidth for implementation" — offered onboarding but
didn't quantify time savings.

**Next Steps:** Send case study by EOD Friday. Schedule 30-min demo
with CTO + 2 engineers. Research competitor contract clause.

**Coaching:** Great discovery first 10 min. Missed ROI quantification.
Talk-to-listen 60/40; aim 40/60. **Quality: 7/10**

Error Handling

ErrorCauseFix
recording_url returns 403Recording expiredCheck Close recording retention settings
Whisper timeoutFile > 25 MBSplit audio or use Deepgram streaming
Garbled transcriptPoor audio, multiple speakersUse Deepgram with diarization
Mave truncationTranscript too longSend first 8,000 chars or pre-summarize