Scenario
Account executives spend 30+ minutes researching each account before a call. This job pulls Account fields (industry, revenue, employee count, description), related Contacts, and recent Tasks/Notes via SOQL, then sends everything to Mave Agent. The output is a cited research brief with competitive context, industry trends, and messaging recommendations — ready in seconds.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_query(soql):
r = requests.get(f"https://{SF}/services/data/v66.0/query", headers=SF_H, params={"q": soql})
r.raise_for_status()
return r.json()["records"]
aid = "0015e000001XyZa"
acct = sf_query(f"SELECT Name, Industry, AnnualRevenue, NumberOfEmployees, Description FROM Account WHERE Id = '{aid}'")[0]
contacts = sf_query(f"SELECT Name, Title FROM Contact WHERE AccountId = '{aid}' ORDER BY CreatedDate DESC LIMIT 10")
tasks = sf_query(f"SELECT Subject, Description, ActivityDate FROM Task WHERE AccountId = '{aid}' ORDER BY ActivityDate DESC LIMIT 10")
contact_block = "\n".join(f"- {c['Name']} ({c.get('Title', 'N/A')})" for c in contacts)
task_block = "\n".join(f"- [{t.get('ActivityDate', 'N/A')}] {t.get('Subject', '')}: {(t.get('Description') or '')[:200]}" for t in tasks)
prompt = f"""Research this account and produce an AE-ready intelligence brief.
ACCOUNT: {acct['Name']} | {acct.get('Industry', 'N/A')} | ${acct.get('AnnualRevenue', 'N/A')} | {acct.get('NumberOfEmployees', 'N/A')} employees
Description: {acct.get('Description', 'N/A')}
KEY CONTACTS
{contact_block}
RECENT ACTIVITY
{task_block}
Produce: 1) Company overview & news 2) Industry trends 3) Competitive landscape 4) Messaging angles 5) Discovery questions"""
brief = 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(brief.get("content", ""))
print(f"Sources: {len(brief.get('sources', []))}")
const SF = process.env.SALESFORCE_INSTANCE;
const SF_T = process.env.SALESFORCE_ACCESS_TOKEN;
const MV_K = process.env.MAVERA_API_KEY;
async function sfQuery(soql) {
const res = await fetch(
`https://${SF}/services/data/v66.0/query?q=${encodeURIComponent(soql)}`,
{ headers: { Authorization: `Bearer ${SF_T}` } }
);
return (await res.json()).records;
}
const aid = "0015e000001XyZa";
const [acct] = await sfQuery(`SELECT Name, Industry, AnnualRevenue, NumberOfEmployees, Description FROM Account WHERE Id = '${aid}'`);
const contacts = await sfQuery(`SELECT Name, Title FROM Contact WHERE AccountId = '${aid}' ORDER BY CreatedDate DESC LIMIT 10`);
const tasks = await sfQuery(`SELECT Subject, Description, ActivityDate FROM Task WHERE AccountId = '${aid}' ORDER BY ActivityDate DESC LIMIT 10`);
const contactBlock = contacts.map((c) => `- ${c.Name} (${c.Title || "N/A"})`).join("\n");
const taskBlock = tasks.map((t) => `- [${t.ActivityDate || "N/A"}] ${t.Subject}: ${(t.Description || "").slice(0, 200)}`).join("\n");
const prompt = `Research this account and produce an AE-ready intelligence brief.
ACCOUNT: ${acct.Name} | ${acct.Industry || "N/A"} | $${acct.AnnualRevenue || "N/A"} | ${acct.NumberOfEmployees || "N/A"} employees
KEY CONTACTS\n${contactBlock}\nRECENT ACTIVITY\n${taskBlock}
Produce: 1) Overview & news 2) Industry trends 3) Competitive landscape 4) Messaging angles 5) Discovery questions`;
const brief = await fetch("https://app.mavera.io/api/v1/mave/chat", {
method: "POST",
headers: { Authorization: `Bearer ${MV_K}`, "Content-Type": "application/json" },
body: JSON.stringify({ message: prompt }),
}).then((r) => r.json());
console.log(brief.content);
console.log(`Sources: ${(brief.sources || []).length}`);
Example Output
## Acme Corp — Manufacturing | $120M Revenue | 850 Employees
### Company Overview
Acme Corp is expanding into European markets. Recent press highlights a
new Stuttgart facility and a $15M Series D focused on supply chain digitization.
### Industry Trends
- IoT-driven predictive maintenance investments up 23% YoY
- EU ESG reporting mandates require new compliance tooling
- Labor shortages accelerating automation spend
### Competitive Landscape
Current vendors: SAP (ERP), Tableau (analytics). Recent RFP activity
suggests dissatisfaction with reporting capabilities.
### Messaging Recommendations
1. Lead with speed-to-value — VP Eng responded to POC speed last cycle
2. Emphasize EU compliance given Stuttgart expansion
3. Avoid per-seat pricing framing — CFO flagged this
### Discovery Questions
- "How is the Stuttgart expansion changing your reporting requirements?"
- "What's your timeline for EU ESG compliance tooling?"
Sources: 4
Mave automatically cites its sources. Store the
sources array alongside the brief so AEs can verify claims.Salesforce Overview
Back to all 8 Salesforce jobs
Sales Note → Brand Voice
Next: Extract winning language from deal notes