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

# Salesforce CRM

> Integration details and setup guide for the Salesforce CRM connector in Alloy Automation.

## Pre-Built Tooling

| Category                            | Details                                                                                                 |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------- |
| **Authentication**                  | OAuth 2.0 (Authorization Code with refresh tokens)                                                      |
| **Two-Way Sync**                    | Yes                                                                                                     |
| **Events Supported**                | Yes                                                                                                     |
| **Realtime**                        | Yes (via Webhooks and Platform Events)                                                                  |
| **Supports Rate Limiting**          | Yes (API limits based on Salesforce edition)                                                            |
| **Authentication Scopes Supported** | `api`, `refresh_token`, `id`, `profile`, `email`, `offline_access`, `chatter_api`, `openid`, CDP scopes |

***

## Objects Supported

Alloy Automation supports syncing the following objects from **Salesforce CRM**:

* **Accounts**
* **Contacts**
* **Leads**
* **Opportunities**
* **Tasks**
* **Notes**
* **Orders**
* **Products (Product2)**

***

## Set Up Guide

### Trial Access

| Question                                           | Answer                                                                                                                                                    |
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Offers free trial?**                             | Yes. Salesforce offers a 30-day free trial of Sales Cloud and other products. [Start free trial](https://www.salesforce.com/form/signup/freetrial-sales/) |
| **Requires paid sandbox**                          | No. Developer Edition (free forever) and trial editions include sandbox environments.                                                                     |
| **Requires partnership to obtain authentication?** | No. Any developer can create a Connected App for OAuth authentication.                                                                                    |

***

### Authentication (OAuth 2.0)

For customers who want to completely whitelabel their OAuth experience, you can provide your own developer keys instead of using Alloy Automation's.

<step>
  ## Step 1: Sign Up for Salesforce Developer Edition

  1. Visit **Salesforce Developers** ([https://developer.salesforce.com/signup](https://developer.salesforce.com/signup))
  2. Fill out the registration form to create a free Developer Edition org
  3. Verify your email and log into your new Salesforce instance
  4. Your instance URL will be in the format: `https://your-domain.my.salesforce.com`
</step>

<step>
  ## Step 2: Create a Connected App

  1. Log into your Salesforce org
  2. Navigate to **Setup** (gear icon in top right)
  3. In Quick Find, search for **App Manager**
  4. Click **New Connected App**
  5. Fill in the required fields:
     * **Connected App Name**: Your application name
     * **API Name**: Auto-populated based on name
     * **Contact Email**: Your email address
  6. Enable **OAuth Settings**:
     * Check **Enable OAuth Settings**
     * **Callback URL**: `https://api.runalloy.com/api/strategy/connector/salesforceCRM/callback`
     * **Selected OAuth Scopes**: Select the scopes you need:
       * `Access and manage your data (api)`
       * `Perform requests on your behalf at any time (refresh_token, offline_access)`
       * `Access your basic information (id, profile, email, address, phone)`
     * Optionally enable **Require Secret for Web Server Flow** for added security
  7. Click **Save**
  8. Wait 2-10 minutes for the changes to propagate
</step>

<step>
  ## Step 3: Retrieve OAuth Credentials

  1. In **App Manager**, find your Connected App
  2. Click the dropdown and select **View**
  3. Copy the **Consumer Key** (Client ID)
  4. Click **Click to reveal** next to **Consumer Secret** (Client Secret)
  5. Copy the **Consumer Secret**
  6. Note your Salesforce instance URL (subdomain)
</step>

<step>
  ## Step 4: Configure Alloy Automation

  1. In Alloy Automation, configure your Salesforce CRM connector
  2. Provide:
     * **Client ID** (Consumer Key)
     * **Client Secret** (Consumer Secret)
     * **Subdomain**: Your Salesforce instance subdomain (e.g., `your-domain`)
  3. Initiate the OAuth flow
  4. Log into Salesforce and authorize the requested permissions
  5. Alloy Automation will receive the authorization code and exchange it for tokens
</step>

***

## Use Cases

### 1) Automated lead capture

Capture leads from web forms, landing pages, or marketing platforms and automatically create lead records in Salesforce with proper assignment rules and lead scoring.

### 2) Bi-directional contact sync

Keep contact records synchronized between Salesforce and email marketing platforms, customer support tools, or other CRMs, ensuring sales and marketing teams have consistent data.

### 3) Opportunity pipeline automation

Trigger workflows when opportunities change stages, sending notifications, updating related systems, or creating tasks for follow-up actions automatically.

### 4) Order and product management

Sync orders and product information between Salesforce and e-commerce, ERP, or fulfillment systems, maintaining accurate order status and inventory data.

### 5) Customer 360 integration

Aggregate customer data from multiple sources into Salesforce accounts and contacts, creating a complete customer profile with interaction history, support tickets, and purchase data.

***

## API Gotchas

* **API Request Limits:** Salesforce enforces API request limits based on your edition (e.g., Enterprise Edition: 100,000 calls/24 hours). Monitor your API usage in Setup under System Overview. Requests that exceed limits will receive 403 errors.

* **Field-Level Security:** Even with proper OAuth scopes, field-level security (FLS) and object permissions control data access. If certain fields return null or operations fail with insufficient privileges errors, check the connected app user's profile and permission sets.

* **Composite API for Bulk Operations:** For bulk creates/updates, use Salesforce's Composite API or Bulk API 2.0 instead of making individual REST calls. This reduces API call consumption and improves performance.

* **Custom Objects and Fields:** Salesforce custom objects end with `__c` (e.g., `MyObject__c`). Custom fields also use `__c` suffix. When querying or updating custom objects, always include the `__c` namespace.

* **Governor Limits:** Salesforce has governor limits (e.g., max 200 records per REST API request, 50,000 records per Bulk API batch). Design your integration to handle these limits with pagination and batching strategies.

> For questions or troubleshooting, contact **[support@runalloy.com](mailto:support@runalloy.com)**.
