For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configure Salesforce authentication

Setting Up A Credentials Connection

  1. Obtain your login credentials:

    • Username: your Salesforce login name.

    • Password: your Salesforce account password.

Configure Salesforce authentication setup
  1. After logging in, click on your profile picture on the upper right.

Configure Salesforce authentication setup
  1. A dropdown menu will appear, click on Settings.

Configure Salesforce authentication setup
  1. On the Settings page, on the left navigation, select Reset My Security Token.

Configure Salesforce authentication setup
  1. Click on Reset Security Token.

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

Configure Salesforce authentication setup
  1. Finally, in the email, this will be the Security token that will be used for the connection.

Configure Salesforce authentication setup

Steps to connect:

  1. Add the Salesforce node from the Apps section into your StackAI project.

Configure Salesforce authentication setup
  1. Select "Query Salesforce" as the Action.

Configure Salesforce authentication setup
  1. Click on "Select a connection" or create a new connection with your credentials.

Configure Salesforce authentication setup
  1. Choose the appropriate domain for your Salesforce environment:

    Domain
    Use 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)

Configure Salesforce authentication setup

Note that the Username for your API is different from the email address you used to sign up for Salesforce.

  • 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.

  1. 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.

Show Python Script

Setting Up An OAuth2 Connector + Connection:

  1. Navigate to Setup (the gear in the top right corner), enter App Manager in the Quick Find box, and click New External Client App in the top right corner.

Configure Salesforce authentication setup
  1. Name the app and fill out the required information.

  2. Ensure you select Enable OAuth under Enable OAuth Settings.

  3. Type in your callback url. It should be the base web URL followed by /auth. For our Cloud offering, the URL is https://www.stackai.com/auth

  4. Add the permissions your client needs. At minimum, usually Access and manage your data (api) and Perform requests on your behalf at any time (refresh_token, offline_access) are required.

  5. Under Flow Enablement, toggle on at least Enable Authorization Code Flow

  6. Under Security, select Enable Refresh Token Rotation, this will allow us to keep your connection alive.

  7. Click Create

  8. Go to Settings of your created app. Under OAuth settings, go to Consumer Key and Secret.

  9. 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.

Configure Salesforce authentication setup

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

Configure Salesforce authentication setup

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?