Salesforce Fast integrations

Complete Salesforce CRM integration for real-time data access, lead management, opportunity tracking, duplicate detection, and bulk operations. One-click OAuth connection with fast, reliable API access.

Audits

Pass

Install

openclaw skills install salesforce-easy

Salesforce CRM Skill

The fastest, most reliable way to work with Salesforce data in OpenClaw.

This skill provides complete Salesforce CRM integration with one-click OAuth authentication, real-time data access, intelligent duplicate detection, bulk operations, and comprehensive SOQL query support. Built for SDRs, sales teams, and anyone who needs instant access to their Salesforce data without the usual friction.

When to Use This Skill

Use this skill when the user wants to:

  • Connect to Salesforce - Authenticate with OAuth 2.0 (one-click setup)
  • Query data - Search leads, contacts, accounts, opportunities, or any Salesforce object
  • Create records - Add new leads, contacts, opportunities, accounts, tasks, events
  • Update records - Modify existing Salesforce records with new data
  • Delete records - Remove records from Salesforce
  • Find duplicates - Detect duplicate leads, contacts, or accounts based on email, phone, or name
  • Bulk operations - Create, update, or delete multiple records at once
  • Get record details - Fetch complete information about specific records
  • Search across objects - Use SOSL to search across multiple Salesforce objects
  • Manage relationships - Link contacts to accounts, opportunities to contacts, etc.
  • Track activities - Create tasks, log calls, schedule events
  • Generate reports - Pull data for analysis, dashboards, or exports
  • Data cleanup - Identify and merge duplicates, update stale records
  • Lead management - Qualify leads, convert to opportunities, assign ownership
  • Pipeline tracking - Monitor opportunity stages, close dates, deal values

Common user requests:

  • "Show me all leads from last week"
  • "Find duplicate contacts with the same email"
  • "Create a new opportunity for Acme Corp worth $50K"
  • "Update the lead status to 'Qualified'"
  • "Get all open opportunities closing this month"
  • "Find all contacts at TechCo"
  • "Add a task to follow up with John Smith tomorrow"
  • "Show me my top 10 deals by value"
  • "Find all accounts in California"
  • "Create 50 leads from this CSV file"

What This Skill Does

🔐 One-Click Authentication

  • OAuth 2.0 flow with automatic token management
  • Secure credential storage
  • Token refresh handling
  • Multi-org support (sandbox and production)
  • No manual API setup required

📊 Real-Time Data Access

  • Lightning-fast queries (< 1 second response)
  • Full SOQL support for complex queries
  • SOSL for cross-object search
  • Relationship queries (parent-child, lookup fields)
  • Aggregate functions (COUNT, SUM, AVG, MAX, MIN)
  • Date filtering and grouping

🎯 Smart Duplicate Detection

  • Email-based duplicate detection
  • Phone number matching
  • Name similarity matching (fuzzy logic)
  • Company name matching
  • Multi-field duplicate detection
  • Configurable matching rules

⚡ Bulk Operations

  • Create up to 200 records at once
  • Update multiple records in single API call
  • Delete in bulk with safety checks
  • CSV import support
  • Batch processing for large datasets
  • Progress tracking for long operations

🔍 Advanced Search

  • Search by any field (email, phone, name, company, etc.)
  • Filter by date ranges
  • Sort by any field
  • Limit and offset for pagination
  • Custom SOQL queries
  • Saved search templates

📝 Complete CRUD Operations

  • Create: Leads, Contacts, Accounts, Opportunities, Tasks, Events, Custom Objects
  • Read: Query any object with full field access
  • Update: Modify any editable field
  • Delete: Remove records with confirmation

🔗 Relationship Management

  • Link contacts to accounts
  • Associate opportunities with contacts
  • Create account hierarchies
  • Manage campaign members
  • Track opportunity contact roles

📈 Sales Pipeline Features

  • Opportunity stage tracking
  • Close date monitoring
  • Deal value calculations
  • Win/loss analysis
  • Forecast reporting

How It Works

1. First-Time Setup (One-Time, 2 Minutes)

Step 1: Install Dependencies

pip install -r requirements.txt

Security note: Always install from requirements.txt — versions are pinned to reviewed releases.

Step 2: Authenticate with Salesforce

The skill will guide you through OAuth authentication:

  1. User says: "Connect to Salesforce"
  2. Skill generates OAuth URL
  3. User clicks URL and authorizes
  4. Skill receives token automatically
  5. Connection ready to use!

Alternative: Use Existing Credentials

If you already have Salesforce credentials:

Option A — Salesforce Platform CLI (easiest, no secrets needed):

# 1. Install CLI (one time)
npm install -g @salesforce/cli

# 2. Login via browser (one time)
sf org login web --alias myorg

# 3. Extract token into skill
python scripts/oauth.py platform --alias myorg

Option B — Connected App OAuth 2.0 flow:

# Generate auth URL, authorize in browser, then exchange code
python scripts/connect.py oauth <client_id>
python scripts/oauth.py exchange
# Env vars needed: SALESFORCE_CLIENT_ID, SALESFORCE_CLIENT_SECRET, SALESFORCE_OAUTH_CODE

Option C — Username + security token (.env):

# .env file (never commit to source control)
SALESFORCE_USERNAME=your@email.com
SALESFORCE_PASSWORD=<password>
SALESFORCE_SECURITY_TOKEN=<security-token>

Use a dedicated least-privilege integration user, not an admin account.

2. Using the Skill (Instant)

Once connected, just ask in natural language:

Query Examples:

  • "Show me all leads created this week"
  • "Find contacts at Acme Corp"
  • "Get open opportunities over $50K"
  • "Search for john@example.com"

Create Examples:

  • "Create a lead: John Smith, john@acme.com, Acme Corp, VP Sales"
  • "Add a new opportunity: Acme Deal, $75K, Prospecting stage"
  • "Create a task to call Sarah tomorrow"

Update Examples:

  • "Update lead status to Qualified for john@acme.com"
  • "Change opportunity stage to Proposal for Acme Deal"
  • "Mark task as completed"

Duplicate Detection:

  • "Find duplicate leads"
  • "Show me contacts with duplicate emails"
  • "Check for duplicate accounts named Acme"

Bulk Operations:

  • "Create 50 leads from this list"
  • "Update all leads from California to 'West Region'"
  • "Delete all leads with status 'Unqualified'"

Safety & Best Practices

🔒 Security

  • OAuth tokens stored securely in environment variables
  • No credentials in code or logs
  • Token encryption at rest
  • Automatic token refresh
  • Session timeout after inactivity

✅ Data Validation

  • Required field validation before API calls
  • Email format validation
  • Phone number format validation
  • Duplicate detection before creation
  • Confirmation prompts for bulk operations

🛡️ Error Handling

  • Clear error messages for API failures
  • Retry logic for transient errors
  • Rate limit handling (automatic backoff)
  • Network timeout handling
  • Invalid query detection

⚠️ Destructive Operations

  • Delete operations require confirmation
  • Bulk deletes show count before execution
  • Soft delete support (move to recycle bin)
  • Undo capability for recent operations
  • Audit trail for all changes

📊 Performance

  • Query result caching (5-minute TTL)
  • Batch API calls when possible
  • Pagination for large result sets
  • Lazy loading for related records
  • Connection pooling

🔍 Duplicate Detection Rules

  • Email: Exact match (case-insensitive)
  • Phone: Normalized format matching
  • Name: Fuzzy matching (85% similarity threshold)
  • Company: Exact match (case-insensitive)
  • Custom: User-defined matching rules

Common Workflows

Workflow 1: Lead Qualification

User: "Show me unqualified leads from this week"
→ Skill queries leads with Status='Unqualified' and CreatedDate=THIS_WEEK
→ Returns list with key fields (Name, Email, Company, Phone)

User: "Update the first one to Qualified"
→ Skill updates lead status
→ Confirms update with record details

Workflow 2: Duplicate Cleanup

User: "Find duplicate contacts"
→ Skill scans contacts for duplicate emails
→ Returns grouped duplicates with record IDs

User: "Merge the first group, keep the newest"
→ Skill merges records, preserving newest data
→ Confirms merge and shows final record

Workflow 3: Opportunity Pipeline

User: "Show me opportunities closing this month"
→ Skill queries opportunities with CloseDate=THIS_MONTH
→ Returns sorted by CloseDate

User: "What's the total value?"
→ Skill calculates SUM(Amount)
→ Returns total pipeline value

Workflow 4: Bulk Lead Import

User: "Create leads from this CSV: [uploads file]"
→ Skill parses CSV
→ Validates required fields
→ Checks for duplicates
→ Creates leads in batches of 200
→ Returns success count and any errors

Workflow 5: Account Research

User: "Get all contacts at Acme Corp"
→ Skill finds Account named "Acme Corp"
→ Queries related Contacts
→ Returns contact list with roles

User: "Show me their open opportunities"
→ Skill queries opportunities for that account
→ Returns opportunity details

Supported Salesforce Objects

Standard Objects (Full Support)

  • Lead - Prospective customers
  • Contact - People at accounts
  • Account - Companies/organizations
  • Opportunity - Sales deals
  • Task - To-do items
  • Event - Calendar events
  • Case - Customer support tickets
  • Campaign - Marketing campaigns
  • Product2 - Products/services
  • PricebookEntry - Product pricing
  • Quote - Price quotes
  • Contract - Customer contracts
  • Order - Customer orders

Custom Objects

  • Full support for all custom objects
  • Query by API name (e.g., "Custom_Object__c")
  • Create, read, update, delete operations
  • Relationship queries

Query Language Support

SOQL (Salesforce Object Query Language)

-- Simple query
SELECT Name, Email FROM Lead WHERE Status = 'Open'

-- With relationships
SELECT Name, Account.Name FROM Contact WHERE Account.Industry = 'Technology'

-- Aggregates
SELECT COUNT(Id), SUM(Amount) FROM Opportunity WHERE StageName = 'Closed Won'

-- Date filters
SELECT Name FROM Lead WHERE CreatedDate = THIS_WEEK

-- Sorting and limits
SELECT Name, Amount FROM Opportunity ORDER BY Amount DESC LIMIT 10

SOSL (Salesforce Object Search Language)

-- Search across objects
FIND {john@example.com} IN EMAIL FIELDS RETURNING Lead, Contact

-- Search with filters
FIND {Acme} IN NAME FIELDS RETURNING Account(Name, Industry WHERE Industry = 'Technology')

API Rate Limits

Salesforce enforces API rate limits based on your org's license:

  • Developer Edition: 15,000 API calls per 24 hours
  • Professional Edition: 1,000 API calls per 24 hours per user
  • Enterprise Edition: 5,000 API calls per 24 hours per user
  • Unlimited Edition: 5,000 API calls per 24 hours per user

This skill handles rate limits automatically:

  • Tracks API usage
  • Warns when approaching limits
  • Implements exponential backoff
  • Queues requests when limit reached
  • Provides usage statistics

Troubleshooting

Connection Issues

Problem: "Authentication failed" Solution:

  1. Check SALESFORCE_INSTANCE_URL is correct
  2. Verify access token is valid (not expired)
  3. Re-authenticate using OAuth flow
  4. Check network connectivity

Problem: "Invalid session ID" Solution: Token expired - re-authenticate

Query Issues

Problem: "Invalid SOQL query" Solution:

  1. Check field names are correct (case-sensitive)
  2. Verify object API names
  3. Use describe to see available fields
  4. Check relationship syntax

Problem: "No results found" Solution:

  1. Verify filter criteria
  2. Check record sharing/permissions
  3. Try broader search terms

Performance Issues

Problem: "Query timeout" Solution:

  1. Add LIMIT clause to reduce results
  2. Use selective filters (indexed fields)
  3. Avoid querying large text fields
  4. Use bulk API for large datasets

Duplicate Detection Issues

Problem: "Too many duplicates found" Solution:

  1. Refine matching criteria
  2. Use stricter matching rules
  3. Filter by date range
  4. Process in batches

Advanced Features

Custom SOQL Queries

User: "Run this SOQL: SELECT Name, Email FROM Lead WHERE Company LIKE '%Tech%' ORDER BY CreatedDate DESC LIMIT 50"
→ Skill executes custom query
→ Returns results in table format

Relationship Queries

User: "Get all contacts at accounts in California with their opportunities"
→ Skill builds complex relationship query
→ Returns nested data structure

Bulk API

User: "Create 5000 leads from this file"
→ Skill uses Bulk API (not REST API)
→ Processes in background
→ Provides job ID for tracking
→ Notifies when complete

Field-Level Security

User: "Show me all fields for this lead"
→ Skill respects field-level security
→ Only shows fields user has access to
→ Indicates restricted fields

Record Types

User: "Create a lead with record type 'Enterprise'"
→ Skill looks up record type ID
→ Creates lead with correct record type
→ Validates required fields for that type

Performance Benchmarks

Based on testing with real Salesforce orgs:

  • Simple query (< 100 records): 0.3-0.8 seconds
  • Complex query (100-1000 records): 0.8-2 seconds
  • Duplicate detection (1000 records): 2-5 seconds
  • Bulk create (200 records): 3-6 seconds
  • Bulk update (200 records): 2-4 seconds
  • OAuth authentication: 5-10 seconds (one-time)

Version History

v1.0.0 (2026-05-06)

  • Initial release
  • OAuth 2.0 authentication
  • Full CRUD operations for all standard objects
  • Duplicate detection (email, phone, name)
  • Bulk operations (create, update, delete)
  • SOQL and SOSL support
  • Relationship queries
  • Rate limit handling
  • Error recovery
  • Comprehensive documentation

Support & Feedback

Created by: Sawera Khadium License: MIT Issues: Report bugs or request features via GitHub issues Documentation: Full API reference in /references/salesforce-api.md

Installation

# Install via ClawHub
clawhub install sawera-khadium/salesforce-crm

# Or manually
cd ~/.openclaw/skills/
git clone https://github.com/sawera-khadium/salesforce-crm-skill.git salesforce-crm
cd salesforce-crm
pip install -r requirements.txt

Quick Start

# 1. Install pinned dependencies
pip install -r requirements.txt

# 2. Configure credentials in .env (never export raw secrets in shell)
#    Copy .env.example to .env and fill in your values — see README for details.

# 3. Start using!
# Say: "Show me all leads from this week"

Skill Instructions for AI Agent

When the user requests Salesforce operations, follow this workflow:

1. Check Connection

  • Verify SALESFORCE_INSTANCE_URL and SALESFORCE_ACCESS_TOKEN are set
  • If not set, guide user through OAuth authentication
  • Test connection with simple query (SELECT Id FROM User LIMIT 1)

2. Parse User Intent

Identify the operation type:

  • Query: "show", "get", "find", "list", "search"
  • Create: "create", "add", "new", "insert"
  • Update: "update", "change", "modify", "edit"
  • Delete: "delete", "remove"
  • Duplicate: "duplicate", "duplicates", "find duplicates"
  • Bulk: "bulk", "multiple", "batch", "import"

3. Extract Parameters

From user message, extract:

  • Object type: Lead, Contact, Account, Opportunity, etc.
  • Fields: Which fields to query/update
  • Filters: WHERE conditions
  • Values: Data for create/update
  • Limits: How many records

4. Build Query/Operation

  • Construct SOQL query or API call
  • Validate required fields
  • Check for duplicates (if creating)
  • Add safety limits (max 200 for bulk)

5. Execute

  • Call appropriate script in /scripts/
  • Handle errors gracefully
  • Retry on transient failures
  • Respect rate limits

6. Format Response

  • Present results in readable format
  • Use tables for multiple records
  • Highlight key information
  • Provide record IDs for reference
  • Suggest next actions

7. Confirm Destructive Operations

Before deleting or bulk updating:

  • Show what will be affected
  • Ask for explicit confirmation
  • Provide undo option if possible

Example Interactions

Example 1: Simple Query

User: "Show me leads from this week"

Agent: I'll query leads created this week from Salesforce.

[Executes: SELECT Id, Name, Email, Company, Status FROM Lead WHERE CreatedDate = THIS_WEEK]

Found 23 leads created this week:

| Name | Email | Company | Status |
|------|-------|---------|--------|
| John Smith | john@acme.com | Acme Corp | Open |
| Sarah Johnson | sarah@techco.com | TechCo | Qualified |
| ... (21 more) |

Would you like to see more details or filter these results?

Example 2: Duplicate Detection

User: "Find duplicate contacts"

Agent: I'll scan for duplicate contacts based on email addresses.

[Executes duplicate detection script]

Found 12 duplicate groups (28 total duplicate contacts):

Group 1: john@example.com
- Contact ID: 003xx000001234AAA (Created: 2026-01-15)
- Contact ID: 003xx000005678BBB (Created: 2026-03-20)

Group 2: sarah@company.com
- Contact ID: 003xx000009012CCC (Created: 2025-12-10)
- Contact ID: 003xx000003456DDD (Created: 2026-02-05)

... (10 more groups)

Would you like me to merge any of these duplicates?

Example 3: Bulk Create

User: "Create these 5 leads: [provides list]"

Agent: I'll create 5 new leads in Salesforce. Let me check for duplicates first.

[Checks for existing leads with same emails]

No duplicates found. Creating 5 leads...

[Executes bulk create]

✓ Successfully created 5 leads:
- John Smith (Lead ID: 00Qxx000001234AAA)
- Sarah Johnson (Lead ID: 00Qxx000005678BBB)
- Mike Davis (Lead ID: 00Qxx000009012CCC)
- Emily Chen (Lead ID: 00Qxx000003456DDD)
- David Wilson (Lead ID: 00Qxx000007890EEE)

All leads have been assigned to you and set to "Open" status.

Example 4: Update with Confirmation

User: "Update all leads from California to 'West Region'"

Agent: This will update the Region field for all leads in California. Let me check how many records will be affected.

[Queries: SELECT COUNT() FROM Lead WHERE State = 'CA']

This will update 47 leads. Do you want to proceed? (yes/no)

User: "yes"

Agent: Updating 47 leads...

[Executes bulk update]

✓ Successfully updated 47 leads to Region = 'West Region'

Summary:
- Records updated: 47
- Time taken: 2.3 seconds
- API calls used: 1

This skill is production-ready and follows all ClawHub best practices for security, performance, and user experience.