# Salesforce

## Setup Guide

You can find your Salesforce application credentials by visiting your [Salesforce developer dashboard](https://developer.salesforce.com/).

You'll need the following information to set up your Salesforce App with KollaConnect:

* Consumer ID
* Consumer Secret

### Configure your Salesforce app

1. Go to your Salesforce setup page and type "App Manager" in the search box, and select "App Manager" from the results.
2. If you don't have an app already, create a new app by clicking on "New Connected App"

<figure><img src="/files/9RQuSt8ETTCib6m7AMX7" alt=""><figcaption></figcaption></figure>

3\. Add your app name and other information as required

4\. Check the box next to "Enable OAuth Settings. In the redirect URLs section, add the KollaConnect OAuth2 redirect URL:

```
https://connect.getkolla.com/oauth
```

5\. Then add the OAuth scopes your integration will need.

{% hint style="info" %}
The following scopes are required to work with KollaConnect:

* Perform requests at any time (refresh\_token, offline access)
* Manage user data via APIs (api)
  {% endhint %}

<figure><img src="/files/rdEzr5O3Z45rRF4nRoJt" alt=""><figcaption></figcaption></figure>

6\. Hit save, noting the the Consumer ID and Consumer Secret for use later.

### Add your Salesforce app to Kolla

1\. In the Kolla admin portal, go to **Integrations > Connectors** and click **Add Connector**.

2\. Choose Salesforce from the catalog of connectors

3\. Name your instance of this connector and input the following configuration items:

* **Consumer ID** (from Salesforce app setup in previous steps)
* **Client Secret (**(from Salesforce app setup in previous steps)&#x20;

Press the save button to finish adding this connector.

## Connecting to Salesforce

Once your users have connected their Salesforce account, you can use the Kolla SDK to access your users' Salesforce access token and use that to connect to Salesforce.

See the [Salesforce API documentation](https://developer.salesforce.com/docs/apis) for their full API reference.

{% tabs %}
{% tab title="Node.js" %}

<pre class="language-javascript"><code class="lang-javascript">// Use KollaConnect client to get your user's salesforce access token
kolla.authenticate(KOLLA_API_KEY)

// Get the consumer's auth token to salesforce
<strong>var clientSalesforceToken = kolla.getToken("salesforce", customerId)
</strong>
var jsforce = require('jsforce');
var conn = new jsforce.Connection({
  accessToken: clientSalesforceToken
});

var records = [];
conn.query("SELECT Id, Name FROM Account", function(err, result) {
  if (err) { return console.error(err); }
  console.log("total : " + result.totalSize);
  console.log("fetched : " + result.records.length);
  console.log("done ? : " + result.done);
  if (!result.done) {
    // you can use the locator to fetch next records set.
    // Connection#queryMore()
    console.log("next records URL : " + result.nextRecordsUrl);
  }
});

</code></pre>

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getkolla.com/kolla/connector-guides/salesforce.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
