> ## Documentation Index
> Fetch the complete documentation index at: https://modem.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce

> Sync CRM context and query Salesforce read-only through the Modem Agent

export const Prompt = ({text, variant = 'accent'}) => {
  const [copied, setCopied] = useState(false);
  const handleCopy = async () => {
    try {
      await navigator.clipboard.writeText(text);
      setCopied(true);
      setTimeout(() => setCopied(false), 2000);
    } catch {}
  };
  const clipboardIcon = <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <title>Copy</title>
            <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
            <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
        </svg>;
  const checkIcon = <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <title>Copied</title>
            <polyline points="20 6 9 17 4 12" />
        </svg>;
  const promptIcon = <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style={{
    flexShrink: 0,
    opacity: 0.4
  }}>
            <title>Prompt</title>
            <path d="M20 2H2v20h2V4h16v12H6v2H4v2h2v-2h16V2zM6 7h12v2H6zm8 4H6v2h8z" />
        </svg>;
  return <div className={`prompt prompt-${variant}`} style={{
    marginTop: '12px',
    marginBottom: '12px'
  }}>
            {promptIcon}
            <span className="prompt-text">{text}</span>
            <button className="prompt-copy" onClick={handleCopy} title="Copy to clipboard" type="button">
                {copied ? checkIcon : clipboardIcon}
            </button>
        </div>;
};

The Salesforce integration syncs core CRM records into Modem and gives the Modem Agent read-only access to your Salesforce org. The agent can query CRM data alongside conversations and topics, then act through your other connected tools.

<Info>
  Salesforce access is **read-only**. Modem does not create, update, or delete Salesforce records. Synced records update about every 15
  minutes rather than in real time.
</Info>

## Prerequisites

* **Admin or Owner** role in your Modem organization
* A Salesforce administrator who can install the Modem managed package
* A Salesforce user who can authorize the connection and access the objects and fields you want Modem to read
* A production Salesforce org. Salesforce sandboxes are not supported yet.

## Setup

<Steps>
  <Step title="Open the Salesforce integration">
    Go to **Settings** → **Integrations** → **Salesforce** in your Modem dashboard.
  </Step>

  <Step title="Install the Modem package">
    Click **Install Modem package**. Sign in to the production Salesforce org you want to connect, then have a Salesforce administrator
    approve the package installation.

    You don't need to copy an API key, client ID, or client secret into Modem.
  </Step>

  <Step title="Connect your Salesforce org">
    Return to the Salesforce integration page in Modem and click **Connect Salesforce**. Sign in as the Salesforce user Modem should
    use, then approve access.

    We recommend a dedicated integration user with read-only access to only the objects and fields your team needs.
  </Step>

  <Step title="Confirm the connection">
    After authorization, Modem returns you to the integration page. A healthy connection shows **Connected** with your Salesforce
    instance hostname.
  </Step>
</Steps>

## What Gets Synced

Modem runs an initial sync after connecting, then checks Salesforce for changes about every 15 minutes.

| Object            | Synced CRM context                                           |
| ----------------- | ------------------------------------------------------------ |
| **Accounts**      | Company details, ownership, industry, revenue, and location  |
| **Contacts**      | Names, contact details, account relationships, and ownership |
| **Opportunities** | Stage, amount, close date, outcome, account, and ownership   |
| **Users**         | Names, email addresses, titles, and active status            |

The sync is incremental and read-only. It does not create discussions or topics, fire automation triggers, or write changes back to Salesforce.

## What the Agent Can Query

The synced objects provide CRM context inside Modem. The agent can also query Salesforce directly when you ask, including standard and custom objects that are queryable by the connected Salesforce user.

The agent can:

* List queryable standard and custom objects
* Inspect an object's fields, picklist values, and relationships
* Run read-only SOQL `SELECT` queries, including relationship fields and child queries
* Fetch a record by its Salesforce object name and record ID
* Combine Salesforce data with Modem conversations, topics, people, and companies
* Act on the result through other connected tools, such as posting a summary or creating a ticket

The agent cannot create, update, or delete Salesforce records.

### Example prompts

<Prompt text="Which open opportunities belong to accounts that reported billing problems this month?" />

<Prompt text="Show opportunities closing this quarter with an amount over $50,000, grouped by owner" />

<Prompt text="What queryable Salesforce objects are related to renewals?" />

<Prompt text="Summarize recent feedback from accounts with open opportunities and post it to #sales" />

## Access and Permissions

Salesforce's permission model controls what Modem can read. If the connected user cannot query an object or field, neither the sync nor the agent can access it.

Use a dedicated integration user when possible. Grant it API access and read access only to the CRM data your team wants available in Modem. Modem stores the resulting OAuth tokens encrypted and refreshes them automatically.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Salesforce can't find the app during authorization">
    Install the Modem package before clicking **Connect Salesforce**. Confirm that you installed it in the same production Salesforce
    org you're authorizing. Salesforce sandboxes aren't supported yet.
  </Accordion>

  <Accordion title="Modem asks for additional scopes">
    Click **Reconnect** in the notice on the Salesforce integration page and approve the requested access. Reconnecting updates the
    authorization without duplicating synced records.
  </Accordion>

  <Accordion title="The integration shows 'Connection Error'">
    The settings page checks the connection regularly. If the error persists, disconnect Salesforce, reconnect it, and authorize with a
    user who still has API access. Contact [support@modem.dev](mailto:support@modem.dev) if reconnecting doesn't restore a healthy connection.
  </Accordion>

  <Accordion title="New or changed records aren't visible yet">
    Salesforce records update about every 15 minutes, so recent changes may not appear immediately. Sync can also pause when the
    Salesforce org is close to its daily API limit. Confirm that the connected user can read the affected object and field, then check
    again after the next sync.
  </Accordion>

  <Accordion title="The agent can't find an object or field">
    Ask the agent to list Salesforce objects or describe the object first. If the object or field is missing, confirm that it is
    queryable and visible to the connected Salesforce user.
  </Accordion>
</AccordionGroup>

## Disconnecting

To disconnect Salesforce:

1. Go to **Settings** → **Integrations** → **Salesforce**
2. Click **Disconnect**
3. Confirm the disconnection

Disconnecting removes the connection from Modem and stops new data from syncing. Modem also asks Salesforce to revoke the authorization. The agent can no longer query the Salesforce org. Historical data remains in Modem after disconnecting.

## Related

<CardGroup cols={2}>
  <Card title="The Modem Agent" icon="https://mintcdn.com/modem-844d7a4a/Wr2r4IRr97lNQiQb/icons/bot.svg?fit=max&auto=format&n=Wr2r4IRr97lNQiQb&q=85&s=2496f9106cb54fa9f4e27ad1f8f3a171" href="/docs/features/agent" width="22" height="22" data-path="icons/bot.svg">
    Query connected data and take action from one conversation.
  </Card>

  <Card title="Companies & People" icon="https://mintcdn.com/modem-844d7a4a/Wr2r4IRr97lNQiQb/icons/contact.svg?fit=max&auto=format&n=Wr2r4IRr97lNQiQb&q=85&s=727cb0ef6c8547993c6acfdaa30bd837" href="/docs/guides/people" width="24" height="24" data-path="icons/contact.svg">
    See how Modem organizes customer and company context.
  </Card>

  <Card title="Integrations Overview" icon="https://mintcdn.com/modem-844d7a4a/Wr2r4IRr97lNQiQb/icons/link.svg?fit=max&auto=format&n=Wr2r4IRr97lNQiQb&q=85&s=e774d33588635d44c6c935b78ed55f13" href="/docs/integrations/overview" width="24" height="24" data-path="icons/link.svg">
    Explore all integrations and how they fit together.
  </Card>
</CardGroup>
