This documentation describes the integration of MindsDB with Salesforce, the world’s most trusted customer relationship management (CRM) platform. The integration allows MindsDB to access data from Salesforce and enhance it with AI capabilities.
Before proceeding, ensure the following prerequisites are met:
Establish a connection to Salesforce from MindsDB by executing the following SQL command and providing its handler name as an engine.
Required connection parameters include the following:
username
: The username for the Salesforce account.password
: The password for the Salesforce account.client_id
: The client ID (consumer key) from a connected app in Salesforce.client_secret
: The client secret (consumer secret) from a connected app in Salesforce.Optional connection parameters include the following:
is_sandbox
: The setting to indicate whether to connect to a Salesforce sandbox environment (true
) or production environment (false
). This parameter defaults to false
.To create a connected app in Salesforce and obtain the client ID and client secret, follow the steps given below:
Settings
> Open Advanced Setup
> Apps
> App Manager
.New Connected App
, select Create a Connected App
and click Continue
.Connected App Name
, API Name
and Contact Phone
.Enable OAuth Settings
checkbox, set the Callback URL
to wherever MindsDB is deployed followed by /verify-auth
(e.g., http://localhost:47334/verify-auth
), and choose the following OAuth scopes:Save
and then Continue
.Manage Consumer Details
under API (Enable OAuth Settings)
, and copy the Consumer Key (client ID) and Consumer Secret (client secret).Back to Manage Connected Apps
and then Manage
.Edit Policies
.OAuth Policies
, configure the Permitted Users
and IP Relaxation
settings according to your security policies. For example, to enable all users to access the app without enforcing any IP restrictions, select All users may self-authorize
and Relax IP restrictions
respectively. Leave the Refresh Token Policy
set to Refresh token is valid until revoked
.Save
.Identity
> OAuth and OpenID Connect Settings
.Allow OAuth Username-Password Flows
checkbox is checked.Retrieve data from a specified table by providing the integration and table names:
Run SOQL queries directly on the connected Salesforce account:
The above examples utilize salesforce_datasource
as the datasource name, which is defined in the CREATE DATABASE
command.
We have implemented a filtering logic to exclude tables that are generally not useful for direct business queries, which fall into the following categories: