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

CSMs walk into QBRs underprepared because the context lives across Cases, Activity History, and Account health scores. This job pulls Account health, open Cases, and recent Activities from Salesforce, sends the full context to Mave Agent, and gets back tailored QBR questions, risk flags, and expansion suggestions. Every QBR becomes a strategic conversation.

Architecture

Code

import os, requests

SF   = os.environ["SALESFORCE_INSTANCE"]
SF_T = os.environ["SALESFORCE_ACCESS_TOKEN"]
MV_K = os.environ["MAVERA_API_KEY"]
SF_H = {"Authorization": f"Bearer {SF_T}"}

def sf_q(soql):
    return requests.get(f"https://{SF}/services/data/v66.0/query", headers=SF_H, params={"q": soql}).json()["records"]

aid = "0015e000001XyZa"
acct = sf_q(f"SELECT Name, Industry, AnnualRevenue, Health_Score__c, Contract_End_Date__c, NumberOfEmployees FROM Account WHERE Id = '{aid}'")[0]
cases = sf_q(f"SELECT CaseNumber, Subject, Status, Priority, Description FROM Case WHERE AccountId = '{aid}' ORDER BY CreatedDate DESC LIMIT 20")
acts = sf_q(f"SELECT Subject, Description, ActivityDate FROM Task WHERE AccountId = '{aid}' ORDER BY ActivityDate DESC LIMIT 15")

open_cases = [c for c in cases if c.get("Status") not in ("Closed", "Resolved")]
hi_pri = [c for c in cases if c.get("Priority") in ("High", "Critical")]

case_blk = "\n".join(f"- [{c.get('Priority','Normal')}] {c.get('Subject','N/A')}{c.get('Status')}: {(c.get('Description') or '')[:120]}" for c in cases[:12])
act_blk = "\n".join(f"- [{a.get('ActivityDate','N/A')}] {a.get('Subject','')}: {(a.get('Description') or '')[:120]}" for a in acts)

prompt = f"""Prepare a QBR document for this customer.

ACCOUNT: {acct['Name']} | {acct.get('Industry','N/A')} | ${acct.get('AnnualRevenue','N/A')} | Health: {acct.get('Health_Score__c','N/A')}/100
Contract End: {acct.get('Contract_End_Date__c','N/A')} | Employees: {acct.get('NumberOfEmployees','N/A')}

CASES ({len(open_cases)} open, {len(hi_pri)} high-priority)
{case_blk}

RECENT ACTIVITY
{act_blk}

Generate: 1) Executive summary (health, risk, opportunity) 2) Key wins 3) Risk flags with mitigations 4) 8 tailored QBR questions 5) Expansion opportunities 6) 30-min agenda 7) Talk track for top support issue"""

qbr = requests.post(
    "https://app.mavera.io/api/v1/mave/chat",
    headers={"Authorization": f"Bearer {MV_K}", "Content-Type": "application/json"},
    json={"message": prompt},
).json()

print("=== QBR Prep ===")
print(qbr.get("content", ""))
print(f"Sources: {len(qbr.get('sources', []))}")

Example Output

=== QBR Prep — Acme Corp (Health: 72/100) ===

## Executive Summary
Acme Corp is healthy but at-risk — usage is strong (72/100) but three
open P1 cases signal friction in the reporting module. Contract renewal
is in 90 days with expansion opportunity in their new European team.

## Key Wins
- Reduced report generation from 4 hours to 15 minutes
- Onboarded 35 new APAC users successfully
- Zero security incidents since SOC 2 certification

## Risk Flags
1. Reporting frustration — 3 open P1 cases. Bring PM to QBR for roadmap preview.
2. Champion departure — VP Ops (primary sponsor) left. Identify new champion.
3. Renewal in 90 days — No conversation started. Present ROI + multi-year option.

## QBR Questions
1. "How has the APAC rollout affected your team's workflow?"
2. "What's your biggest challenge heading into Q2?"
3. "Are the reporting issues blocking any initiatives?"
4. "Who should we be working more closely with?"
5. "Are other departments evaluating similar solutions?"
6. "What would make renewal a no-brainer?"
7. "How is the European expansion changing your requirements?"
8. "What does success look like for you in the next 6 months?"

## Agenda (30 min)
- 0–5: Wins recap + ROI metrics
- 5–10: Open issues and resolution plan
- 10–20: Discovery questions (expansion signals)
- 20–25: Product roadmap preview
- 25–30: Renewal timeline and next steps

Sources: 2
Store the QBR prep as a Salesforce Note on the Account: POST /sobjects/Note with ParentId set to the Account ID.

Salesforce Overview

Back to all 8 Salesforce jobs

CRM-to-Persona Pipeline

Next: Build personas from your CRM contacts