Configure Salesforce authentication
Setting Up A Credentials Connection
Obtain your login credentials:
Username: your Salesforce login name.
Password: your Salesforce account password.

After logging in, click on your profile picture on the upper right.

A dropdown menu will appear, click on Settings.

On the Settings page, on the left navigation, select Reset My Security Token.

Click on Reset Security Token.

On click, the new Security token will be sent to the email associated to your Salesforce account.

Finally, in the email, this will be the Security token that will be used for the connection.

Steps to connect:
Add the Salesforce node from the Apps section into your StackAI project.

Select "Query Salesforce" as the Action.

Click on "Select a connection" or create a new connection with your credentials.

Choose the appropriate domain for your Salesforce environment:
DomainUse When"login" or left blank
Connecting to production or developer orgs
"test"
Connecting to a sandbox instance
mycustomdomain
Using a custom domain (recommended for SSO or OAuth setups)

Enabling the "sandbox" toggle tells StackAI to connect to your Salesforce sandbox environment instead of your main (production) Salesforce account.
Disabling the "sandbox" toggle means StackAI will connect to your production Salesforce environment.
Add your Salesforce Schema in the configurations of the node to define which table you want to extract.
For example: TABLE Contact (Id TEXT, Name TEXT, Industry TEXT);

Configure Salesforce authentication setup To list tables from your Salesforce account, you can run the included Python script below on your local machine.
Setting Up An OAuth2 Connector + Connection:
Navigate to Setup (the gear in the top right corner), enter
App Managerin the Quick Find box, and click New External Client App in the top right corner.

Name the app and fill out the required information.
Ensure you select Enable OAuth under Enable OAuth Settings.
Type in your callback url. It should be the base web URL followed by
/auth. For our Cloud offering, the URL ishttps://www.stackai.com/authAdd the permissions your client needs. At minimum, usually
Access and manage your data (api)andPerform requests on your behalf at any time (refresh_token, offline_access)are required.Under Flow Enablement, toggle on at least Enable Authorization Code Flow
Under Security, select Enable Refresh Token Rotation, this will allow us to keep your connection alive.
Click Create
Go to Settings of your created app. Under OAuth settings, go to Consumer Key and Secret.
Save the key and secret you see here.
Salesforce OAuth2 Connector
In StackAI, go to Connectors in Settings. Search for Salesforce, and create a new OAuth2 Connector. Enter the key and secret you got from Salesforce here and click Create.

To establish a connection, select the new Connector you created in any connection dialog window, you will be automatically redirected to sign in to Salesforce, or logged in automatically if you are signed in already.
Visual overview

Below are some examples of valid SQL queries for your Salesforce database, provided that it has been included in the Schema:
Connection fields and action reference
See Salesforce for the current connector fields and supported actions.
Was this helpful?

