Ingest Salesforce Cases, Opportunities, Accounts, Tasks, Chatter, and Notes into CortexDB.
Salesforce Connector
Captures CRM activity from Salesforce as CortexDB experiences. Platform Events for low-latency; SOQL polling as a fallback.
Two ways to run this connector:
- Run it yourself (Free + paid) —
pip install 'cortexdb-connectors[salesforce]'thencortexdb-sync sync salesforce. The connector reads your token from~/.cortexdb/state.json(written bycortexdb init) or from env vars. - Managed sync (Starter and up) — CortexDB runs the connector as a worker on its infrastructure. Configure it once from your dashboard; CortexDB handles webhook registration, retries, backfill, and idempotency.
1. Prepare credentials in Salesforce
Setup → App Manager → New Connected App. Enable OAuth with scopes api + refresh_token. Generate Consumer Key + Consumer Secret. Authorize once to mint a refresh token.
2. Configure in your CortexDB dashboard
- Sign in at cortexdb.ai/login.
- Settings → Connectors → Add Connector → Salesforce.
- Paste the Instance URL (e.g.
https://acme.my.salesforce.com), client ID, client secret, and refresh token. - Pick the Salesforce objects to sync. Default:
Case, Opportunity, Account, Task, FeedItem. - Set the scope template. Default:
org:<your-org>/source:salesforce/object:{object_type}. - Pick sync mode: Real-time (Platform Events) or Polling.
- Click Start sync.
What gets written
| Salesforce object | Modality | Notes |
|---|---|---|
| Case | document | Subject + description; status changes as triples |
| Opportunity | document | Name + amount; stage transitions as fact triples (full bi-temporal — won/lost dates land as valid_from/valid_to) |
| Account | observation | Industry, employees, billing as triples |
| Task / Event | observation | With Activity Date as observed_at |
| Chatter (FeedItem) | conversation | role=user; preceded_by for replies |
idempotency_key shape: sfdc:<object>:<id>:<system_modstamp>.
Why CRM is a great fit
Sales states change all the time (deal_stage: poc → close → signed). The bi-temporal model preserves the complete history of every change — GET /v1/facts/timeline?subject=opp_xxx&predicate=stage reconstructs the deal trajectory exactly.
Run it yourself
If you'd rather host the connector yourself instead of using CortexDB's managed worker, every connector ships in the cortexdb-connectors PyPI package:
pip install 'cortexdb-connectors[salesforce]'
# Step 1: get a CortexDB token + actor (one-time, free tier)
pip install cortexdb-cli
cortexdb init
# Step 2: supply the connector's third-party credentials
export SF_INSTANCE_URL=... # required
export SF_CLIENT_ID=... # required
export SF_CLIENT_SECRET=... # required
export SF_USERNAME=... # required
export SF_PASSWORD=... # required
# Step 3: one-shot sync, or `watch` for a poll loop
cortexdb-sync sync salesforce
cortexdb-sync watch salesforce --interval 60
cortexdb-sync reads your CortexDB token + actor from ~/.cortexdb/state.json automatically. Cursor state is persisted in ~/.cortexdb/connectors-state.json, so re-running picks up where the last cycle left off.