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.

Info

Two ways to run this connector:

  • Run it yourself (Free + paid) — pip install 'cortexdb-connectors[salesforce]' then cortexdb-sync sync salesforce. The connector reads your token from ~/.cortexdb/state.json (written by cortexdb 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

  1. Sign in at cortexdb.ai/login.
  2. Settings → Connectors → Add Connector → Salesforce.
  3. Paste the Instance URL (e.g. https://acme.my.salesforce.com), client ID, client secret, and refresh token.
  4. Pick the Salesforce objects to sync. Default: Case, Opportunity, Account, Task, FeedItem.
  5. Set the scope template. Default: org:<your-org>/source:salesforce/object:{object_type}.
  6. Pick sync mode: Real-time (Platform Events) or Polling.
  7. Click Start sync.

What gets written

Salesforce objectModalityNotes
CasedocumentSubject + description; status changes as triples
OpportunitydocumentName + amount; stage transitions as fact triples (full bi-temporal — won/lost dates land as valid_from/valid_to)
AccountobservationIndustry, employees, billing as triples
Task / EventobservationWith Activity Date as observed_at
Chatter (FeedItem)conversationrole=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.

See also