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:
- OAuth 2 Client Credentials
- OAuth 2 JWT
Prerequisites
Before setting up the Salesforce connector, ensure you have:
- Administrator access to your Salesforce instance
- Ability to create Connected Apps in Salesforce
- 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
-
Login to your Salesforce instance
- For example, if Leena AI has a Salesforce instance, its login URL would be https://leenai.my.salesforce.com
-
Navigate to Setup:
- Click on the gear icon in the top-right corner
- Select Setup
-
Create New Connected App:
- Navigate to Apps → App Manager
- Click on New Connected App button
-
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
-
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)
-
Save the application:
- Click Save
- A separate page/section will render with App details
-
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
- Navigate to Setup → Apps → App Manager
- Find your Connected App and click on the dropdown arrow
- Click Edit Policies
- Under Client Credentials Flow, choose a user under Run as section
- The token will be generated for this user
- Click Save
Step 3: Create Connector in Leena AI
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "Salesforce" and select it from the list to add its new connector
- Select one of the 2 authentication types:
Option 1: OAuth 2 Client Credentials
| Parameter | Description | Example |
|---|---|---|
| Consumer Key | OAuth application consumer key | Generated from Salesforce Connected App |
| Consumer Secret | OAuth application consumer secret | Generated from Salesforce Connected App |
Option 2: OAuth 2 JWT
| Parameter | Description | Example |
|---|---|---|
| Consumer Key | OAuth application consumer key | Generated from Salesforce Connected App |
| Private Key | JWT private key | Generated private key |
- Click Test Connection to verify the setup
- If successful, click Save to store the connector configuration
Supported Actions
Leena AI Salesforce connector supports the following actions:
| Action Name | Description |
|---|---|
| Create a record | Create a record |
| Update a record | Update a record |
| Delete a record by ID | Delete a record, given its record id |
| Get all the records | Return all Salesforce records, for a given object name |
| Get a record by ID | Return 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:
-
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.
-
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.
-
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.
-
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
- Consumer Secret Security: Store Consumer Key and Consumer Secret securely
- Principle of Least Privilege: Only grant necessary OAuth scopes to the Connected App
- Access Monitoring: Monitor API usage through Salesforce admin panels
- Regular Audits: Review connector permissions and access logs periodically
- 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 Name | Description | Example |
|---|---|---|
| Impersonate User | Select user on whose behalf the action should be taken. The impersonated user would become the action taker | [email protected] |
| Object Name | Select the object under which a new record needs to be created | Account |
| Object specific fields | All the properties/fields specific to the selected object | Varies 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
- Account Management: Create new customer or partner accounts
- Sales Pipeline: Create opportunities and deals
- Lead Generation: Add new leads from various sources
- Contact Management: Create contact records for stakeholders
- Support Ticketing: Create cases for customer issues
- 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 Name | Description | Example |
|---|---|---|
| Impersonate User | Select user on whose behalf the action should be taken. The impersonated user would become the action taker | [email protected] |
| Object Name | Select the object under which a record needs to be updated | Account |
| Record ID | The unique ID of the record for an object, which needs to be updated | L1001 |
| Object specific fields | All the properties/fields specific to the selected record | Varies 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
- Account Updates: Update customer information, addresses, or details
- Opportunity Management: Update deal stages, amounts, or close dates
- Contact Maintenance: Update contact details or roles
- Lead Qualification: Update lead status and ratings
- Case Management: Update case status and resolutions
- 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 Name | Description | Example |
|---|---|---|
| Impersonate User | Select user on whose behalf the action should be taken. The impersonated user would become the action taker | [email protected] |
| Object Name | Select the object under which the record needs to be fetched | Account |
| Record ID | The unique ID of the record for an object, which needs to be fetched | L1001 |
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
- Record Verification: Verify record details after creation or update
- Information Retrieval: Fetch complete record information for analysis
- Status Checking: Check current status of opportunities or cases
- Data Export: Retrieve record data for external systems
- Audit Trail: Review record history and modifications
- 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 Name | Description | Example |
|---|---|---|
| Impersonate User | Select user on whose behalf the action should be taken. The impersonated user would become the action taker | [email protected] |
| Object Name | Select the object under which the record needs to be deleted/trashed | Account |
| Record ID | The unique ID of the record for an object which needs to be deleted | L1001 |
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
- Data Cleanup: Remove duplicate or test records
- Record Management: Delete invalid or incorrect records
- Compliance: Remove records as per data retention policies
- Opportunity Cleanup: Delete cancelled or invalid opportunities
- Lead Management: Remove spam or invalid leads
- Case Closure: Delete duplicate or spam cases
Best Practices
Before Deleting:
- Verify Record: Ensure you have the correct record ID
- Check Dependencies: Review related records and dependencies
- Backup Data: Consider exporting important data before deletion
- Review Permissions: Ensure the user has delete permissions
After Deleting:
- Audit Trail: Maintain records of deleted items
- Notification: Inform relevant stakeholders about deletions
- Recycle Bin: Remember that deleted records go to Salesforce Recycle Bin
- 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
Updated about 19 hours ago
