Query Notes from Closed Won opportunities, aggregate winning language, and feed it into Mavera’s Brand Voice engine to create a ‘Sales Winning Language’ profile
Your best reps already know the winning language — it’s buried in their deal notes. This job queries Notes attached to Closed Won opportunities, aggregates the value-prop phrasing that closes deals, and feeds it into Mavera’s Brand Voice engine. The output is a “Sales Winning Language” voice profile that marketing can use to mirror phrases that actually convert.
import os, requestsSF = 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}"}opps = requests.get( f"https://{SF}/services/data/v66.0/query", headers=SF_H, params={"q": "SELECT Id FROM Opportunity WHERE StageName = 'Closed Won' ORDER BY CloseDate DESC LIMIT 50"},).json()["records"]opp_ids = "','".join(o["Id"] for o in opps)notes = requests.get( f"https://{SF}/services/data/v66.0/query", headers=SF_H, params={"q": f"SELECT Title, Body FROM Note WHERE ParentId IN ('{opp_ids}') ORDER BY CreatedDate DESC LIMIT 200"},).json()["records"]combined = "\n\n---\n\n".join( f"[{n.get('Title', 'Untitled')}]\n{n.get('Body', '')}" for n in notes)[:50_000]bv = requests.post( "https://app.mavera.io/api/v1/brand-voices", headers={"Authorization": f"Bearer {MV_K}", "Content-Type": "application/json"}, json={"name": "Sales Winning Language", "extracted_content": combined},).json()print(f"Brand Voice ID: {bv['id']} — extracted from {len(notes)} notes across {len(opps)} won deals")