SharePoint


Setup connector

Salesforce is a cloud-based software that helps businesses connect with customers through a variety of products and services such as:

  • Customer 360: A suite of products that unifies sales, service, marketing, commerce, and IT teams with a single view of customer information
  • CRM apps: Apps for sales, service, marketing, commerce, and more
  • AI and data: Trusted AI and data on one integrated platform
  • Tableau CRM: A data visualisation and business intelligence platform that is tightly integrated with Salesforce's products

Overview

Leena AI integrates with Salesforce.com using Salesforce REST API.

The Salesforce connector supports two OAuth 2.0 authentication methods:

  1. OAuth 2 Client Credentials
  2. OAuth 2 JWT

Prerequisites

Before setting up the Salesforce connector, ensure you have:

  1. Administrator access to your Salesforce instance
  2. Ability to create Connected Apps in Salesforce
  3. Access to your Leena AI workspace with connector management permissions

Authorization Through Connected Apps and OAuth 2.0

For a client application to access REST API resources, it must be authorized as a safe visitor. To implement this authorization, use a connected app and an OAuth 2.0 authorization flow.

A connected app requests access to REST API resources on behalf of the client application. For a connected app to request access, it must be integrated with your org's REST API using the OAuth 2.0 protocol. OAuth 2.0 is an open protocol that authorises secure data sharing between applications through the exchange of tokens.

Setting up the Salesforce Connector

Step 1: Create Connected App in Salesforce

  1. Login to your Salesforce instance

  2. Navigate to Setup:

    • Click on the gear icon in the top-right corner
    • Select Setup
  3. Create New Connected App:

    • Navigate to AppsApp Manager
    • Click on New Connected App button
  4. Fill out the required details:

    • Connected App Name: Enter a descriptive name (e.g., "Leena AI Integration")
    • API Name: Auto-generated based on the app name
    • Contact Email: Your admin email address
  5. Configure OAuth Settings:

    • Under API (Enable OAuth Settings), check Enable OAuth Settings
    • Callback URL: Use the URL provided by Leena AI
    • Selected OAuth Scopes: For testing purposes, add "full" scope. For production, select appropriate scopes:
      • Access and manage your data (api)
      • Perform requests on your behalf at any time (refresh_token, offline_access)
      • Full access (full)
  6. Save the application:

    • Click Save
    • A separate page/section will render with App details
  7. Fetch and Save Credentials:

    • Copy the Consumer Key (Client ID)
    • Click Click to reveal next to Consumer Secret and copy it
    • Save these credentials securely (to be used later)

Step 2: Configure Client Credentials Flow

  1. Navigate to SetupAppsApp Manager
  2. Find your Connected App and click on the dropdown arrow
  3. Click Edit Policies
  4. Under Client Credentials Flow, choose a user under Run as section
    • The token will be generated for this user
  5. Click Save

Step 3: Create Connector in Leena AI

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Salesforce" and select it from the list to add its new connector
  4. Select one of the 2 authentication types:

Option 1: OAuth 2 Client Credentials

ParameterDescriptionExample
Consumer KeyOAuth application consumer keyGenerated from Salesforce Connected App
Consumer SecretOAuth application consumer secretGenerated from Salesforce Connected App

Option 2: OAuth 2 JWT

ParameterDescriptionExample
Consumer KeyOAuth application consumer keyGenerated from Salesforce Connected App
Private KeyJWT private keyGenerated private key
  1. Click Test Connection to verify the setup
  2. If successful, click Save to store the connector configuration

Supported Actions

Leena AI Salesforce connector supports the following actions:

Action NameDescription
Create a recordCreate a record
Update a recordUpdate a record
Delete a record by IDDelete a record, given its record id
Get all the recordsReturn all Salesforce records, for a given object name
Get a record by IDReturn the data of a record, given its record id

Use Cases

Some of the use cases that you can achieve using Salesforce connector are below:

  1. Create, Update and Get status of records via Leena AI Assistant - This connector allows you to setup workflows which enables user to create, update or get status of their records via natural language using Leena AI assistant.

  2. Provision or De-provision users at the time of onboarding / off-boarding - Provision for users to be able to add comments on records via Leena AI's virtual assistant which will be reflected to Salesforce portal.

  3. Automate creation of new projects on client onboarding - Integrate with Salesforce CRM to automatically create a new project as soon as a new client onboards.

  4. Receive intelligent recommendations - By leveraging AI-driven insights, sales teams can receive intelligent recommendations on lead prioritization, follow-up actions, and personalized sales pitches, improving conversion rate.

Security Best Practices

  1. Consumer Secret Security: Store Consumer Key and Consumer Secret securely
  2. Principle of Least Privilege: Only grant necessary OAuth scopes to the Connected App
  3. Access Monitoring: Monitor API usage through Salesforce admin panels
  4. Regular Audits: Review connector permissions and access logs periodically
  5. User Impersonation: Use appropriate users for "Run as" configuration

The connector is now ready to be used by your Leena AI Agents for automated Salesforce CRM operations.


Create a record

This action is used to create a Salesforce record under any object.

Input Fields

Field NameDescriptionExample
Impersonate UserSelect user on whose behalf the action should be taken. The impersonated user would become the action taker[email protected]
Object NameSelect the object under which a new record needs to be createdAccount
Object specific fieldsAll the properties/fields specific to the selected objectVaries by object

Example Usage

Create Account Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Account",
  "fields": {
    "Name": "Acme Corporation",
    "Phone": "+1-555-0123",
    "Industry": "Technology",
    "Website": "https://acme.com"
  }
}

Create Opportunity Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Opportunity",
  "fields": {
    "Name": "Q4 Enterprise Deal",
    "StageName": "Prospecting",
    "CloseDate": "2025-12-31",
    "Amount": 100000,
    "AccountId": "0015g00000ABC123"
  }
}

Create Contact Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Contact",
  "fields": {
    "FirstName": "John",
    "LastName": "Doe",
    "Email": "[email protected]",
    "Phone": "+1-555-0456",
    "AccountId": "0015g00000ABC123"
  }
}

Create Lead Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Lead",
  "fields": {
    "FirstName": "Jane",
    "LastName": "Smith",
    "Company": "Tech Innovations Inc",
    "Email": "[email protected]",
    "Status": "New",
    "LeadSource": "Web"
  }
}

Create Case Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Case",
  "fields": {
    "Subject": "Product Issue",
    "Description": "Customer experiencing login issues",
    "Status": "New",
    "Priority": "High",
    "Origin": "Email"
  }
}

Response

Upon successful creation, the action returns:

  • Record ID
  • Object Name
  • Created timestamp
  • Success status

Use Cases

An employee can interact with Leena AI virtual assistant to handle use cases such as:

  • Adding a new account
  • Creating an opportunity
  • Adding new contacts
  • Creating leads from marketing campaigns
  • Logging support cases

Common Use Cases

  1. Account Management: Create new customer or partner accounts
  2. Sales Pipeline: Create opportunities and deals
  3. Lead Generation: Add new leads from various sources
  4. Contact Management: Create contact records for stakeholders
  5. Support Ticketing: Create cases for customer issues
  6. Campaign Management: Create campaign member records

Update a record by ID

This action is used to update a record under a specific Object. The user can update a record using ID.

Input Fields

Field NameDescriptionExample
Impersonate UserSelect user on whose behalf the action should be taken. The impersonated user would become the action taker[email protected]
Object NameSelect the object under which a record needs to be updatedAccount
Record IDThe unique ID of the record for an object, which needs to be updatedL1001
Object specific fieldsAll the properties/fields specific to the selected recordVaries by object

Example Usage

Update Account Details

{
  "impersonateUser": "[email protected]",
  "objectName": "Account",
  "recordId": "0015g00000ABC123",
  "fields": {
    "Phone": "+1-555-9999",
    "BillingCity": "San Francisco",
    "NumberOfEmployees": 500
  }
}

Update Opportunity Stage

{
  "impersonateUser": "[email protected]",
  "objectName": "Opportunity",
  "recordId": "0065g00000XYZ789",
  "fields": {
    "StageName": "Negotiation/Review",
    "Probability": 75,
    "Amount": 150000
  }
}

Update Contact Information

{
  "impersonateUser": "[email protected]",
  "objectName": "Contact",
  "recordId": "0035g00000DEF456",
  "fields": {
    "Email": "[email protected]",
    "Phone": "+1-555-7777",
    "Title": "Senior Manager"
  }
}

Update Lead Status

{
  "impersonateUser": "[email protected]",
  "objectName": "Lead",
  "recordId": "00Q5g00000MNO321",
  "fields": {
    "Status": "Qualified",
    "Rating": "Hot",
    "LeadSource": "Partner Referral"
  }
}

Update Case Resolution

{
  "impersonateUser": "[email protected]",
  "objectName": "Case",
  "recordId": "5005g00000PQR654",
  "fields": {
    "Status": "Closed",
    "Resolution": "Issue resolved by resetting password"
  }
}

Response

Upon successful update, the action returns:

  • Record ID
  • Updated fields
  • Update timestamp
  • Success status

Use Cases

An employee can interact with Leena AI virtual assistant to handle use cases such as:

  • Updating account details
  • Updating opportunity details
  • Modifying contact information
  • Changing lead status
  • Updating case resolution

Common Use Cases

  1. Account Updates: Update customer information, addresses, or details
  2. Opportunity Management: Update deal stages, amounts, or close dates
  3. Contact Maintenance: Update contact details or roles
  4. Lead Qualification: Update lead status and ratings
  5. Case Management: Update case status and resolutions
  6. Data Enrichment: Add or update missing information in records

Get a record by ID

This action is used to get the details of a record under a specific Object (for example, Deals). The user can get the details of a record using Record ID (unique).

Input Fields

Field NameDescriptionExample
Impersonate UserSelect user on whose behalf the action should be taken. The impersonated user would become the action taker[email protected]
Object NameSelect the object under which the record needs to be fetchedAccount
Record IDThe unique ID of the record for an object, which needs to be fetchedL1001

Example Usage

Get Account Details

{
  "impersonateUser": "[email protected]",
  "objectName": "Account",
  "recordId": "0015g00000ABC123"
}

Get Opportunity Details

{
  "impersonateUser": "[email protected]",
  "objectName": "Opportunity",
  "recordId": "0065g00000XYZ789"
}

Get Contact Details

{
  "impersonateUser": "[email protected]",
  "objectName": "Contact",
  "recordId": "0035g00000DEF456"
}

Get Lead Details

{
  "impersonateUser": "[email protected]",
  "objectName": "Lead",
  "recordId": "00Q5g00000MNO321"
}

Get Case Details

{
  "impersonateUser": "[email protected]",
  "objectName": "Case",
  "recordId": "5005g00000PQR654"
}

Response

The action returns detailed record information including:

  • All field values for the specified object
  • Record ID
  • Object type
  • Created date and time
  • Last modified date and time
  • Owner information
  • Related record links

Use Cases

An employee can interact with Leena AI virtual assistant to handle use cases such as:

  • Fetching details of a newly created deal
  • Viewing account information
  • Checking opportunity status
  • Reviewing contact details
  • Accessing case information

Common Use Cases

  1. Record Verification: Verify record details after creation or update
  2. Information Retrieval: Fetch complete record information for analysis
  3. Status Checking: Check current status of opportunities or cases
  4. Data Export: Retrieve record data for external systems
  5. Audit Trail: Review record history and modifications
  6. Customer Service: Access customer information during support calls

Delete a record by ID

This action is used to delete a record under a specific Object (for example, Deals). The user can delete a record by using Record ID (unique).

Input Fields

Field NameDescriptionExample
Impersonate UserSelect user on whose behalf the action should be taken. The impersonated user would become the action taker[email protected]
Object NameSelect the object under which the record needs to be deleted/trashedAccount
Record IDThe unique ID of the record for an object which needs to be deletedL1001

Example Usage

Delete Account Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Account",
  "recordId": "0015g00000ABC123"
}

Delete Opportunity Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Opportunity",
  "recordId": "0065g00000XYZ789"
}

Delete Contact Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Contact",
  "recordId": "0035g00000DEF456"
}

Delete Lead Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Lead",
  "recordId": "00Q5g00000MNO321"
}

Delete Case Record

{
  "impersonateUser": "[email protected]",
  "objectName": "Case",
  "recordId": "5005g00000PQR654"
}

Response

Upon successful deletion, the action returns:

  • Confirmation of successful deletion
  • Deleted record ID
  • Object name
  • Deletion timestamp

Use Cases

An employee can interact with Leena AI virtual assistant to handle use cases such as:

  • Deleting a duplicate deal
  • Removing test records
  • Cleaning up invalid data
  • Removing cancelled opportunities
  • Deleting spam leads

Common Use Cases

  1. Data Cleanup: Remove duplicate or test records
  2. Record Management: Delete invalid or incorrect records
  3. Compliance: Remove records as per data retention policies
  4. Opportunity Cleanup: Delete cancelled or invalid opportunities
  5. Lead Management: Remove spam or invalid leads
  6. Case Closure: Delete duplicate or spam cases

Best Practices

Before Deleting:

  1. Verify Record: Ensure you have the correct record ID
  2. Check Dependencies: Review related records and dependencies
  3. Backup Data: Consider exporting important data before deletion
  4. Review Permissions: Ensure the user has delete permissions

After Deleting:

  1. Audit Trail: Maintain records of deleted items
  2. Notification: Inform relevant stakeholders about deletions
  3. Recycle Bin: Remember that deleted records go to Salesforce Recycle Bin
  4. Recovery: Know the process to recover deleted records if needed

Error Handling

Common error scenarios:

  • Record Not Found: Invalid Record ID
  • Permission Denied: Insufficient delete permissions
  • Record Locked: Record is locked by another process
  • Dependent Records: Record has dependent child records
  • Validation Rules: Record deletion blocked by validation rules