> For the complete documentation index, see [llms.txt](https://docs.kognitos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kognitos.com/guides/platform/integrations/salesforce.md).

# Salesforce

{% hint style="info" %}
The following documentation is for **Salesforce v2.1.0**.
{% endhint %}

## Overview

Salesforce is the world's leading customer relationship management (CRM) platform for sales and marketing automation. This integration enables automated lead management, opportunity tracking, customer communication, and sales pipeline optimization. Enhance sales productivity and customer relationship management.

## Setup

The following integrations need to be connected to your Kognitos workspace:

* **Salesforce**

### Steps

Follow these steps to connect the integration in Kognitos:

{% stepper %}
{% step %}

#### Navigate

Using the left navigation menu, go to **Integrations** → **Explore Integrations**.
{% endstep %}

{% step %}

#### Find

Search for the integration and click on it.
{% endstep %}

{% step %}

#### Connect

Click on <kbd>**Connect**</kbd> to add a connection to the integration.
{% endstep %}

{% step %}

#### Configure

Add a name for the connection. You'll be prompted for [**authentication**](#authentication) details if needed. Then, click on <kbd>**Connect**</kbd>.
{% endstep %}
{% endstepper %}

### Credentials

This section explains how to obtain the credentials needed to connect the Kognitos Integration to your Salesforce account. You can choose from different authentication methods, each requiring different credentials.

#### 1. Client Credentials

This connection method uses OAuth authentication through a Connected App. These steps will walk you through obtaining a consumer key and secret.

{% hint style="success" %}
This authentication method is the most secure and recommended approach.
{% endhint %}

{% stepper %}
{% step %}
**Create a Connected App**

1. Log in to Salesforce
2. Click the **Setup** icon (gear icon in the top right)
3. In the Quick Find box, search for **"App Manager"**
4. Click **New Connected App**
   {% endstep %}

{% step %}
**Configure the Connected App**

1. **Basic Information:**
   1. **Connected App Name:** Enter a name (e.g., "Kognitos Integration")
   2. **API Name:** Will auto-populate
   3. **Contact Email:** Enter your email address
2. **API (Enable OAuth Settings):**
   1. Check **Enable OAuth Settings**
   2. **Callback URL:** Enter `https://login.salesforce.com/services/oauth2/callback` (or your specific callback URL)
   3. **Selected OAuth Scopes:** Add the required scopes:
      1. Access and manage your data (api)
      2. Perform requests on your behalf at any time (refresh\_token, offline\_access)
      3. Full access (full) - if needed
   4. Click **Save**
      {% endstep %}

{% step %}
**Get Consumer Key and Consumer Secret**

1. After saving, navigate back to **Setup** → **App Manager**
2. Find your Connected App and click **View**
3. In the **API (Enable OAuth Settings)** section:
   1. Copy the **Consumer Key** (also called Client ID)
   2. Click **"Click to reveal"** next to **Consumer Secret**
   3. Salesforce will ask you to verify your identity (via email or MFA)
   4. Copy the **Consumer Secret** (also called Client Secret)
      {% endstep %}

{% step %}
**Get Your Domain**

Your Salesforce **domain** is found in your Salesforce URL:

* **With My Domain:** `https://yourcompany.my.salesforce.com`
* **Without My Domain:** `https://na30.salesforce.com` (where "na30" is your instance)

To find it, simply log into Salesforce and look at your browser's address bar.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
For more information, check out the Salesforce documentation: [Create a Connected App](https://help.salesforce.com/s/articleView?id=xcloud.connected_app_create.htm\&type=5).
{% endhint %}

#### 2. Username, Password, Security Token, and Domain

This method uses username-password authentication with an API security token.

{% stepper %}
{% step %}
**Get Your Username**

Your username is the email address you use to log into Salesforce (e.g., `yourname@yourcompany.com`)
{% endstep %}

{% step %}
**Get Your Password**

This is your standard Salesforce account password.
{% endstep %}

{% step %}
**Get Your Security Token**

1. Log in to Salesforce
2. Click your **profile icon** (top right)
3. Select **Settings**
4. In the Quick Find box, type **"Reset"**
5. Click **Reset My Security Token**
6. Click the **Reset Security Token** button
7. Check your email for the new security token
8. Copy the token from the email

**Note:** If you don't see the "Reset My Security Token" option, your organization may have IP restrictions enabled. Try this direct URL:

```
https://[YourDomain].my.salesforce.com/_ui/system/security/ResetApiTokenEdit
```

{% endstep %}

{% step %}
**Get Your Domain**

Your Salesforce **domain** is found in your Salesforce URL:

* **With My Domain:** `https://yourcompany.my.salesforce.com`
* **Without My Domain:** `https://na30.salesforce.com` (where "na30" is your instance)

To find it, simply log into Salesforce and look at your browser's address bar.
{% endstep %}
{% endstepper %}

## Authentication

Use one of the following authentication methods to connect this integration in Kognitos. Each method has its own configuration requirements.

### Connect using Consumer Key, Consumer Secret and Domain

Connect to Salesforce using the OAuth 2.0 Client Credentials flow.

| Label           | Description                                                                          | Type        |
| --------------- | ------------------------------------------------------------------------------------ | ----------- |
| Consumer Key    | The Consumer Key (also called Client ID) from your Connected App.                    | `sensitive` |
| Consumer Secret | The Consumer Secret (also called Client Secret) from your Connected App.             | `sensitive` |
| Domain          | Your Salesforce My Domain prefix (e.g. "mycompany" for mycompany.my.salesforce.com). | `text`      |

### Connect using Username, Password, Security Token and Domain

Connects to a Salesforce instance using username, password, security token and domain.

| Label          | Description                                                                                                                                           | Type        |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| Username       | The Salesforce login email (e.g. <user@company.com>).                                                                                                 | `text`      |
| Password       | The password associated with your Salesforce account.                                                                                                 | `sensitive` |
| Security Token | The security token emailed to you by Salesforce after a token reset. This token is appended to your password internally to authenticate API requests. | `sensitive` |
| Domain         | The Salesforce login domain. Use "login" for production, "test" for sandbox, or your My Domain prefix for custom domains.                             | `text`      |

### Connect using Username, Password and Security Token

Connects to a Salesforce instance using username, password and security token.

| Label          | Description                                                                                                                                           | Type        |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| Username       | The Salesforce login email (e.g. <user@company.com>).                                                                                                 | `text`      |
| Password       | The password associated with your Salesforce account.                                                                                                 | `sensitive` |
| Security Token | The security token emailed to you by Salesforce after a token reset. This token is appended to your password internally to authenticate API requests. | `sensitive` |

## Actions

The following actions are available in the **Salesforce** integration:

### 1. Create a report in salesforce

Creates a report in Salesforce.

### 2. Export a report as a excel

Exports a report as an Excel file.

### 3. Export a report as a table

Exports a report as a Pyarrow Table.

### 4. Retrieve some reports from salesforce

Retrieves reports from Salesforce.

### 5. Send an email in salesforce

Sends an email in Salesforce.

## Concepts

### Salesforce create report body

Information sent to Salesforce to create a report.

| Field Name        | Description                 | Type   |
| ----------------- | --------------------------- | ------ |
| `report_metadata` | The metadata of the report. | `json` |

### Salesforce report

A Salesforce report, modeled as the Salesforce Object (SObject)and defined as a set of data that meets certain criteria, displayed in an organized way. Specified here: <https://developer.salesforce.com/docs/atlas.en-us.object\\_reference.meta/object\\_reference/sforce\\_api\\_objects\\_report.htm>

| Field Name             | Description                                                                                            | Type                 |
| ---------------------- | ------------------------------------------------------------------------------------------------------ | -------------------- |
| `id`                   | The ID of the report.                                                                                  | `text`               |
| `owner_id`             | The ID of the owner of the report.                                                                     | `text`               |
| `name`                 | The name of the report.                                                                                | `text`               |
| `developer_name`       | The unique name of the object in the API.                                                              | `text`               |
| `description`          | The description of the report. Limit: 255 characters.                                                  | `optional[text]`     |
| `folder_name`          | The name of the folder that contains the report.                                                       | `optional[text]`     |
| `namespace_prefix`     | The namespace prefix of the report.                                                                    | `optional[text]`     |
| `format`               | Indicates the format of the report. Can have one of these values: Tabular, Summary, Matrix, or Joined. | `optional[text]`     |
| `is_deleted`           | Indicates whether the report is deleted.                                                               | `optional[boolean]`  |
| `created_date`         | The date and time when the report was created.                                                         | `optional[datetime]` |
| `created_by_id`        | The ID of the user who created the report.                                                             | `optional[text]`     |
| `last_modified_date`   | The date and time when the report was last modified.                                                   | `optional[datetime]` |
| `last_modified_by_id`  | The ID of the user who last modified the report.                                                       | `optional[text]`     |
| `last_referenced_date` | The date and time when the report was last referenced.                                                 | `optional[datetime]` |
| `last_run_date`        | The date and time when the report was last run.                                                        | `optional[datetime]` |
| `last_viewed_date`     | The date and time when the report was last viewed.                                                     | `optional[datetime]` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.kognitos.com/guides/platform/integrations/salesforce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
