Documentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
Status: Live in Playground · Try it: synap.maximem.ai/playground
Open the playground and pick Salesforce — Enterprise Sales Assistant to see the reference implementation running.
What you’ll build
A chat agent for sales reps that:- Pulls live CRM state — accounts, opps, contacts, recent activity
- Remembers rep context — territory, ICP, tone of voice, deal-specific narratives
- Drafts outreach in the rep’s voice, grounded in account history
- Updates Salesforce — log calls, advance opp stages, create follow-up tasks
When to use this recipe
Build this if:- Your reps work out of Salesforce and want an assistant that already knows their book of business
- You want per-rep tone/persona memory (so drafts sound like the rep, not a generic LLM)
- You need bi-directional CRM I/O (read accounts, write activities)
- Account narratives span weeks and need to persist across sessions
Architecture at a glance
The rep is theuser_id; the rep’s org is the customer_id. Account-specific notes get tagged in metadata so they’re recallable per-account.
Stack
| Layer | Choice |
|---|---|
| Synap SDK | maximem-synap (Python) / @maximem/synap (TypeScript) |
| Framework | OpenAI Agents SDK (Python) / Vercel AI SDK (TypeScript) |
| CRM | Salesforce REST + jsforce (Node) or simple-salesforce (Python) |
| LLM | OpenAI gpt-4o |
| Channel | Sidebar widget / Slack DM / web chat — choose what fits your reps |
Prerequisites
- A Synap API key — see Authentication
- A Salesforce Connected App with OAuth + offline refresh tokens for the reps
- Python: Python 3.11+
- TypeScript: Node 18+ and Python 3.11+ on the host
Install
Configure
Build it
1. Identity & scoping
customer_id = <salesforce_org_id>— one tenant per Salesforce orguser_id = <salesforce_user_id>— the sales repconversation_id = <session UUID>- Account-scoped memories get
account_idin metadata so you can retrieve “everything we know about Acme Corp” later
2. Salesforce tools
These wrap your Salesforce client. Authenticate per-rep using their stored refresh token before each call.3. System prompt
System prompt
4. Wire memory + LLM + tools
5. Tagging account-scoped memories
For richer recall (“what’s the latest on Acme?”), tag memories with the account when the conversation is about a specific account:metadata.account_id for account-specific summarization.
Run & verify
Session 1
Session 2 (next day, fresh conversation)
Customize / extend
- Slack interface → wrap
handle_messagein a Slack bot. See Patterns → Slack Bot. - Replay historical activity on initial setup so the assistant has years of context from day one. See Patterns → Replay History.
- Per-territory scoping → if a single rep covers multiple territories that shouldn’t share context, use
metadata.territoryto filter. - HubSpot / other CRMs → replace the Salesforce tool layer; the memory pattern is identical.
- SDR variant → for top-of-funnel work, see AI SDR.
Troubleshooting
Account narrative goes missing across sessions- Confirm
customer_idis the org ID, not the rep ID. Reps within the same org should see shared account context if you want that. - If you want strict per-rep silos, keep
customer_id = org_idand rely onuser_idfor isolation — Synap scopes searches automatically.
- The rep hasn’t given enough signal yet. Capture explicit corrections (“don’t open with ‘I hope this finds you well’”) with
synap_store. - Or seed memory at onboarding with 5–10 of the rep’s recent sent emails as historical documents.
- Salesforce REST has per-org rate limits. Cache
get_accountandget_opportunitiesfor the duration of one chat session.
- Pin
export const runtime = "nodejs". JS SDK requires Node + Python on the host.
Related
- Integrations: OpenAI Agents SDK · Vercel AI SDK
- Concepts: Customer Context · Memory Scopes · Organizational Context
- Patterns: Slack Bot · Replay History · Multi-Tenant SaaS
- Other recipes: AI SDR · Tier Escalation