> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce

> Salesforce is a cloud-based Customer Relationship Management (CRM) software for managing customer relationships and integration with other systems. This SaaS tool helps to create custom solutions for marketing, sales, services and ecommerce as per business requirements. Salesforce has now expanded from just CRM to offer multiple products.

## Creating a Salesforce connection

Create the connection by using one of the following methods:

* [OAuth](#using-oauth)
* [Client Secret](#using-client-secret)

### Using OAuth

#### Creating your connection

1. In the Blink platform, navigate to the **Connections** page > **Add connection**. A New Connection dialog box opens displaying icons of external service providers available.
2. Select the **Salesforce** icon. A dialog box with name of the connection and connection methods appear.
3. (Optional) Edit the name of the connection. At a later stage you cannot edit the name.
4. Click **Salesforce** to authenticate using OAuth.
5. Sign in using your credentials.

### Using Client Secret

To create the connection you:

* Salesforce instance URL (e.g. `https\://\<my_instance_name>.my.salesforce.com`).
* To create an app in Salesforce and get **Consumer ID** and **Secret**.

#### Obtaining the credentials

1. In your Salesforce account, in the upper right corner next to user icon, click **Setup**.

   <img src="https://mintcdn.com/blinkops-2/yuv0j7RWJFirVOzo/img/Salesforce/GoToSetup.png?fit=max&auto=format&n=yuv0j7RWJFirVOzo&q=85&s=a90f1cc81f3a14212f3bf196b7f20e97" alt="GoToSetup" width="534" height="556" data-path="img/Salesforce/GoToSetup.png" />

2. In the left panel, navigate to **Apps** > **App Manager**.

   <img src="https://mintcdn.com/blinkops-2/yuv0j7RWJFirVOzo/img/Salesforce/AppManager.png?fit=max&auto=format&n=yuv0j7RWJFirVOzo&q=85&s=79a167d92cb0486cde2c109e31481ca7" alt="AppManager" width="503" height="877" data-path="img/Salesforce/AppManager.png" />

3. In the upper-right corner, click **New External Client App**.

   <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/GoToNewExternalClientApp.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=6ad09aee5994dc2c77b3fd92eb156e2a" alt="GoToNewConnectedApp" width="2048" height="1039" data-path="img/Salesforce/GoToNewExternalClientApp.png" />

4. In the **Basic Information** fill the following fields:

   * **External Client App Name**
   * **API Name**
   * **Contact Email**
   * **Distribution State to Local**

   <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/BasicInformation.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=8b0d0a9b56f2dcf61629b3cd25fec454" alt="BasicInformation" width="2048" height="687" data-path="img/Salesforce/BasicInformation.png" />

5. In the **API (Enable OAuth Settings)** select **Enable OAuth**.

   <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/EnableOAuth.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=3fb5f109fd186fd2d4eca0ef315d8d54" alt="EnableOAuth" width="2048" height="687" data-path="img/Salesforce/EnableOAuth.png" />

6. In the **App Settings** add a **Callback URL**(You can use **[https://example.com](https://example.com)** since this field is not relevant for this type of OAuth but it's still required).

   <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/CallbackURL.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=8ce003c83d149d9205f51f80abe6b4db" alt="CallbackURL" width="2048" height="972" data-path="img/Salesforce/CallbackURL.png" />

7. In the same category add the scopes:

   * **Perform requests at any time (refresh\_token, offline\_access)**
   * **Manage user data via APIs (API)**

   <img src="https://mintcdn.com/blinkops-2/es9JPaKtvSIQCIZ2/img/Salesforce/scopes.png?fit=max&auto=format&n=es9JPaKtvSIQCIZ2&q=85&s=3070ff4ea3268e6bbdd8d210d356a3d9" alt="Scopes" width="2048" height="972" data-path="img/Salesforce/scopes.png" />

8. In the **Flow Enablement** select:

   * **Enable Client Credentials Flow**

   <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/FlowEnablement.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=0c1649811103b9d4dd526dc3df7cd19c" alt="FlowEnablement" width="2048" height="972" data-path="img/Salesforce/FlowEnablement.png" />

9. Click **Create**

10. Click on **Policies**, then click on **Edit**.

    <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/Policies.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=d9ad233887ae170d440aa3625b7f5465" alt="Policies" width="2048" height="1033" data-path="img/Salesforce/Policies.png" />

11. In **OAuth Policies** select **Enable Client Credentials Flow**, then fill **Run As (Username)**, then **Save**.

    <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/EditPoliciesField.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=83f47a971e8140d3726fbd5fb8b5a2ce" alt="EditPolicies" width="2048" height="1026" data-path="img/Salesforce/EditPoliciesField.png" />

12. Click on **Settings**, then under **OAuth Settings** click on **Consumer Key and Secret**.

    <img src="https://mintcdn.com/blinkops-2/bT_1JCp09z1lxfLl/img/Salesforce/Settings.png?fit=max&auto=format&n=bT_1JCp09z1lxfLl&q=85&s=406671c838a7b73d6e14c87719e0d75a" alt="GoToSettings" width="2048" height="1005" data-path="img/Salesforce/Settings.png" />

13. Copy your credentials and use them to create a connection on Blink.

#### Creating your connection

1. In the Blink platform, navigate to the **Connections** page > **Add connection**. A New Connection dialog box opens displaying icons of external service providers available.

2. Select the **Salesforce** icon. A dialog box with name of the connection and connection methods appears.

3. (Optional) Edit the name of the connection. At a later stage you cannot edit the name.

4. Select **Client Secret** as the method to create the connection.

5. Fill in the parameters:

   * The API address
   * The consumer ID and secret

6. (Optional) Click **Test Connection** to test it.

7. Click **Create connection**. The new connection appears on the **Connections** page.
