← Integrations

Salesforce

Query and update records in a user's Salesforce org.

  • CRM & Sales
  • OAuth 2.0 + PKCE
  • Works on Free plan
  • Bundled in Kirak
  • Maintained by Kirak
View on GitHub →

How to use it

This profile ships with Kirak. Add "integrations" to modules in kirak.json, then name the profile as below. There is nothing to download, and a copy in your project's integrations/ folder is an error.

Environment variables

VariableHolds
KIRAK_INTEGRATION_SALESFORCE_CLIENT_SECRETThe OAuth client secret from the vendor's console. Secret: keep it out of kirak.json and out of source control.
KIRAK_AUTH_ENCRYPTION_KEYSEncrypts stored tokens. Shared by every integration; the module refuses to start without it.

The names follow the integration's name in kirak.json (salesforce here). Name it something else, such as salesforce_sales, and the variables change to match.

Redirect URL

Register this as the redirect (callback) URL in the vendor's console, with your app's address in place of <your-app> (the base_url in kirak.json):

https://<your-app>/integrations/salesforce/callback

How to get your keys

  1. In Salesforce Setup, open App Manager and create a new connected app (or external client app).
  2. Turn on OAuth settings and set the callback URL to https://<your-app>/integrations/salesforce/callback.
  3. Add the OAuth scopes your app needs. At least: api (Access and manage your data through the REST API), refresh_token (added by Kirak so it gets a refresh token)
  4. Save, wait for the app to become active, and copy the Consumer Key (the client ID) and the Consumer Secret (the client secret).
  5. Put the client ID in kirak.json as integrations.providers.salesforce.client_id, and the client secret in the environment as KIRAK_INTEGRATION_SALESFORCE_CLIENT_SECRET. Never put the secret in kirak.json.
  6. For a sandbox org, set integrations.providers.salesforce.settings.login_host to test.salesforce.com.

The vendor's own guide · Instructions out of date? ·Suggest an edit

kirak.json

Scopes
{
  "integrations": {
    "providers": {
      "salesforce": {
        "type": "oauth2",
        "profile": "salesforce",
        "client_id": "your-client-id",
        "scope": [
          "api"
        ],
        "settings": {
          "login_host": "login.salesforce.com"
        }
      }
    }
  }
}

Merged into the profile: scope replaces the profile's default scopes, and refresh_token is always added so Kirak gets a refresh token.

Settings

settings.login_host
The login host: login.salesforce.com for production, test.salesforce.com for a sandbox. Default login.salesforce.com.

Good to know

  • The API lives on the instance URL the token response returns, so the calls go to that host only.
  • The account id is the identity URL from the token response.
  • Not verified against the vendor docs in this session: check the facts before release.
Ask about Kirak on