Skip to main content

Salesforce

Connect your Salesforce org to Squid to manage CRM records and search your Salesforce data

The Salesforce connector's functionality

The Salesforce connector enables Squid AI agents to work with records in your Salesforce org. The connector supports Opportunity, Case, Account, and Incident objects:

CapabilityDescription
Get, create, update, deleteFull record CRUD for Opportunities, Cases, Accounts, and Incidents
Describe objectsRetrieve object metadata such as fields, types, picklist values, and record types
Semantic searchSearch synced Opportunity and Case records using natural language
Knowledge article searchSearch your Salesforce Knowledge articles using natural language

When record syncing is enabled, Squid indexes your Opportunity and Case records (and optionally Salesforce Knowledge articles) into a knowledge base, refreshing every 10 minutes. This allows agents to answer questions like "Find open cases similar to this billing issue" in addition to direct record lookups.

Creating a Salesforce Connected App

The connector authenticates using the OAuth 2.0 Client Credentials Flow, so no user login is involved:

  1. In Salesforce Setup, create a Connected App (or External Client App) with OAuth enabled.

  2. Under the OAuth settings, add the Manage user data via APIs (api) scope.

  3. Enable the Client Credentials Flow for the app.

  4. Assign a run-as user (execution user) for the Client Credentials Flow. The permissions of this user determine what the connector can access, so make sure the user's profile or permission sets grant access to the objects you plan to use (Opportunity, Case, Account, Incident, and Salesforce Knowledge if you enable article syncing).

  5. Copy the app's Consumer Key and Consumer Secret.

For more details, see Salesforce's documentation on configuring a Connected App for the Client Credentials Flow.

Adding the Salesforce connector to your Squid application

  1. Navigate to the Connectors tab in the Squid Console.

  2. Click Available Connectors.

  3. Find the Salesforce connector, and select Add Connector.

  4. Provide the following configuration details:

Connector ID: A string that uniquely identifies the connector in your code.

Domain: The domain of your Salesforce instance, including the protocol and without a trailing slash. For example, https://mycompany.my.salesforce.com.

Consumer Key: The Consumer Key from your Connected App.

Consumer Secret: The Consumer Secret from your Connected App. This is stored securely as a Squid secret.

Sync Opportunities: Enable indexing Opportunity records for semantic search.

Sync Cases: Enable indexing Case records for semantic search.

Sync Knowledge Articles: Enable indexing Salesforce Knowledge articles in a knowledge base for semantic search over documentation and FAQs.

Sync History Days: The number of days of record history to sync. Defaults to 30.

note

Semantic search only covers the record types you enable syncing for. After enabling a sync option, allow some time for the initial sync to complete. Knowledge article syncing indexes published English (en_US) articles.

Using the Salesforce connector in your application

No-code Studio

  1. Navigate to the Studio tab in the Squid Console.

  2. Click Create AI Agent.

  3. Provide an agent ID and description, such as "sales-agent" and "This agent helps the user manage Salesforce records".

  4. Click Add Abilities.

  5. Expand the Salesforce entry and select the Salesforce connector you created earlier.

  6. Give a description for how the agent should use this connection, such as "Call this when a user wants to look up or manage Salesforce opportunities, cases, accounts, or incidents."

  7. Click on Test and try asking the agent "What are my open cases?".

Using the Squid SDK

If you are creating your AI agent with the Squid SDK, connect the Salesforce connector by adding it to the connectedIntegrations option of the ask() function:

await this.squid
.ai()
.agent('AGENT_ID')
.ask('Summarize the open cases for the Acme account', {
connectedIntegrations: [
{
integrationId: 'SALESFORCE_CONNECTOR_ID',
integrationType: 'salesforce',
description: 'Call this connector to look up and manage Salesforce records',
},
],
});

Using the npm package

For programmatic (non-agent) access from your backend or client code, install the @squidcloud/salesforce-client package:

npm install @squidcloud/salesforce-client
import { SquidSalesforceClient } from '@squidcloud/salesforce-client';

const salesforce = new SquidSalesforceClient(squid, 'SALESFORCE_CONNECTOR_ID');

// Look up a record
const opportunity = await salesforce.getOpportunity('OPPORTUNITY_ID', 'Id, Name, StageName, Amount');

// Create a record
await salesforce.createCase({ Subject: 'Billing issue', Origin: 'Web' });

// Semantic search over synced records
const results = await salesforce.searchKnowledgeBase('customers asking about refunds', 'Case', 10);